【问题标题】:Extracting custom attributes in an XSD file在 XSD 文件中提取自定义属性
【发布时间】:2014-11-21 01:07:29
【问题描述】:

我能够使用System.Xml.Schema 类获取所有节点,但我无法查询 b:fieldInfo 节点并使用任何标准 xml 方法提取属性。我不想将其解析为字符串。

 <xs:complexType>
      <xs:sequence>
        <xs:element name="Line1">
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <groupInfo sequence_number="0"/>
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Start" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_offset="0" pos_length="15" sequence_number="1" />

【问题讨论】:

    标签: c# xml xsd schema


    【解决方案1】:

    XDocument 非常简单

    var snip = XDocument.Parse(feildInfo);
    var value = snip.Root.Attribute("justification").Value;
    

    【讨论】:

      猜你喜欢
      • 2016-05-28
      • 1970-01-01
      • 1970-01-01
      • 2016-01-27
      • 1970-01-01
      • 2015-06-18
      • 2016-02-18
      • 2016-07-17
      • 1970-01-01
      相关资源
      最近更新 更多