我在这个网站上注意到有关Notepad ++的其他问题,所以我认为这是一个合适的地方.Mods,如果这不是正确的地方,请搬迁.
如何在Notepad ++中格式化文档?我正在寻找类似于Visual Studio的编辑>高级>格式文档的东西
我有一个大的xml文档,它都在一行上,我希望它用适当的缩进/空格格式化,每行只有一个元素.
编辑:使用库存版本5.9.5,没有插件.
我有一个 xml 文档和架构,当我在 Visual Studio 中打开 xml 文档时,我收到一堆警告,例如:
请求“System.Security.Permissions.FileIOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089”类型的权限失败。
有谁知道这些警告的原因可能是什么?这使得验证 xml 文档变得困难。此外,当我将鼠标悬停在 schemaLocation 属性值下的波浪线上时,工具提示会给出错误“文档中此位置引用的架构包含错误”
提前致谢!
我有一个由多个项目组成的Visual Studio解决方案.在其中一个项目中,我有一个语言本地化资源文件.我想使用ResourceManager在不同的项目中的代码中访问此文件.通常,在访问同一项目中的资源文件时,我会使用:
ResourceManager rm = new ResourceManager("Namespace.LanguageLocalization", Assembly.GetExecutingAssembly());
Run Code Online (Sandbox Code Playgroud)
但是,当我在不同的项目中使用相同的代码时,它找不到资源文件.我仔细检查以确保项目使用资源文件引用该项目,并在类顶部的using语句中声明它.
有什么建议?
我知道之前已经问过这个问题,但是我检查了其他线程,没有人对我有所帮助.我试图将xml反序列化为一个对象,并得到错误:
"<doPublish xmlns='http://usdoj.gov/leisp/lexs/publishdiscover/3.1'>
was not expected."
Run Code Online (Sandbox Code Playgroud)
我的XML看起来像:
<lexspd:doPublish xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://usdoj.gov/leisp/lexs/publishdiscover/3.1 ../xsd/lexs/publish-discover/3.1/publish-discover.xsd"
xmlns:lexspd="http://usdoj.gov/leisp/lexs/publishdiscover/3.1"
xmlns:lexs="http://usdoj.gov/leisp/lexs/3.1">
<lexs:PublishMessageContainer>
<lexs:PublishMessage>
<lexs:PDMessageMetadata>
</lexs:PDMessageMetadata>
</lexs:PublishMessage>
</lexs:PublishMessageContainer>
</lexspd:doPublish>
Run Code Online (Sandbox Code Playgroud)
我用来反序列化的代码如下所示:
XmlSerializer xs = new XmlSerializer(typeof(PublishMessageType));
Encoding encode = new UTF8Encoding();
PDWebService lexpdServiceProxy = new PDWebService();
lexpdServiceProxy.Url = "http://59.60.72.12/";
String pdMessageXml = File.ReadAllText(fileName);
DoPublishType doPublishType = new DoPublishType();
MemoryStream publishMsgMemStream = new MemoryStream(encode.GetBytes(pdMessageXml));
doPublishType.PublishMessageContainer = new PublishMessageType[1];
doPublishType.PublishMessageContainer[0] =
(PublishMessageType)xs.Deserialize(publishMsgMemStream);
Run Code Online (Sandbox Code Playgroud)
我试图反序列化的对象看起来像:(缩短版本)
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "PDWebServiceSoapBinding", Namespace = "http://usdoj.gov/leisp/lexs/publishdiscover/3.1/ws")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(SRMessageType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(AugmentationType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(PayloadObjectReferenceType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(ComplexObjectType))]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(MetadataType))]
public partial …Run Code Online (Sandbox Code Playgroud) 我试图抓住这个网站的所有<entry>标签.它会加载到XDocument中,但我似乎无法抓住任何元素.这是我的代码:<entry>
XDocument netflixPage = new XDocument();
netflixPage = XDocument.Load("http://odata.netflix.com/Catalog/Titles");
foreach (XElement xe in netflixPage.Descendants("entry").ToList())
{
string movieInfo = xe.Value;
}
Run Code Online (Sandbox Code Playgroud) 我已经看过这篇文章如何正确打开FileStream以供XDocument使用,但它没有帮助我,因为我没有本地硬盘驱动器上的文件的路径.这个XDocument正在传递给另一台计算机,因此BaseURI毫无价值.
我想知道如何在不使用本地文件路径的情况下将XDocument转换为FileStream.