草庐IT

list_topics_attributes

全部标签

c# - XSD:使用 Visual Studio xsd.exe 不生成 Array[] 而不是 List<>

我正在使用xsd.exe工具从xsd文件生成类。xsd文件:输出是:///[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd","4.0.30319.1")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAttribute("code")][System.Xml.Serialization.XmlTypeAttribute(Anonymo

c# - LINQ for string StartsWith List<string> 中的某个值

我正在使用LINQ解析XDocument。我想检查XElements之一,键为“BusinessStructure”以我的Listfilters中的字符串之一开始.换句话说,假设我有:x.Element("BusinessStructure").Value="testing123"和varfilters=newList{"test","hello"}使用LINQ,我该如何做......wherex.Element("BusinessStructure").Value.StartsWith(filters[0])selectnew...但是我不想获取过滤器列表的第一个索引,而是想“循环”

xml - XSL : List divided into columns

请帮帮我。有一个节点列表。1234567andsoon...需要将“n”(任意数)个列表等分。如果节点数不均分,则让最后一组节点包含剩余的划分。例如,如果输入列表包含33个元素,输出应该有4个元素均匀分布的部分。在导出处得到3部分9个元素和1个部分6个元素的总和33。输入12...33输出12...91011...181911...272830...33分为4列。 最佳答案 此解决方案不要求要分组到列中的节点应该是兄弟节点:=$vCurPosandnot(position()>$vCurPos+$vNumCols-1)]">应用于此

C# XPathSelectElement 和 xml with attribute xmlns ="http://www.w3.org/2000/09/xmldsig#"Help

我需要读取一个具有属性xmlns="http://www.w3.org/2000/09/xmldsig#"的xml元素。XPathSelectElement给出错误“对象引用未设置到对象的实例。”这是示例代码。varxml="TagATagB";XDocumentxd=XDocument.Parse(xml);varstr=xd.XPathSelectElement("/root/tagB").ToString(SaveOptions.DisableFormatting);Console.WriteLine(str);上面代码的结果是:TagB如果我输入属性,varxml="TagAT

c# - 反序列化为 List 时的 XmlRootAttribute 放置

我有以下XMLTWTRtwitter.comFBfacebook.comSOstackoverflow.com这是代码:publicclassProgram{staticvoidMain(string[]args){varfs=newFileStream(@"D:\temp\Sites.xml",FileMode.Open);varserializer=newXmlSerializer(typeof(List));varinstance=(List)serializer.Deserialize(fs);}}[XmlRoot("Sites")]publicclassSite{public

c# - xsi :type attribute messing up C# XML deserialization

我使用XSD.exe自动生成基于XML模式(.xsd文件)的C#对象。我正在反序列化OpenCover输出,但其中一个部分类没有正确生成。这是导致异常的行:这是MethodPoint类的简化版本:[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd","4.0.30319.33440")][System.SerializableAttribute()][System.Diagnostics.DebuggerStepThroughAttribute()][System.ComponentModel.DesignerCategoryAtt

xml - 如何匹配 xmlns :* attributes with XSLT?

如何将xmlns:*属性与XSLT1.0相匹配?使用我尝试过的RDF文档:(...)(...)但它似乎不适用于xmlns属性。谢谢。 最佳答案 xmlns属性不是普通属性,它们是namespace声明。您需要使用命名空间轴来访问它们。例如: 关于xml-如何匹配xmlns:*attributeswithXSLT?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/2094203/

c# - 将 Dictionary(string, List<string>) 序列化为 xml

这个问题在这里已经有了答案:关闭9年前。PossibleDuplicate:EasywaytoconvertaDictionarytoxmlandvisaversa我有示例类:publicclassSampleClass{publicDictionary>SampleProperties{get;set;}}我想将这个类序列化为xml。我该怎么做?我想要类似于此示例的输出xml:问候

java - 简单的 XML 框架 : XPath matching based on attribute value

给定这样的XML:...SoccerJalkapallo......我怎样才能使用SimpleXMLFramework,将这两个值读入Java类中的字段?(元素已正确映射到相应的类。)publicclassSport{...StringnameEn;StringnameFi;...}我尝试过以下方法:@Element(name="Name")@Path("Name[@language='en']")StringnameEn;但是解析失败:Exceptioninthread"main"org.simpleframework.xml.core.PathException:Invalidin

Java/JAXB : Unmarshall XML elements with same name but different attribute values to different class members

我正在尝试根据属性之一将具有多个“Fields”元素的XML解析为不同的类成员。这是XML:这是它应该映射到的java类:publicclassAPMSeries{privateListselectedFields;privateListfirstSelectedFields;}谁能告诉我如何将具有属性type="SelectedFields"的Fields元素设置为selectedFields成员,并将具有属性type="FirstSelectedFields"的Fields元素设置为firstSelectedFields成员? 最佳答案