Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How to extract Attributes along with their names and datatypes from an XSD file.

$
0
0

Hi All,

I have having trouble extracting attributes along with their names and datatypes and datatype length from XSD file.

My XSD file is of the following structure. There are basically 3 columns in this XSD (Action_needed,Company id,Company Name). From this XSD I need to extract the column names, their datatypes and the maxlength of the datatype. 

Would appreciate any inputs regarding this. Thanks in advance.


  <xs:element name="Companies">
     <xs:complexType>
        <xs:sequence>
            <xs:element ref="Z" maxOccurs="unbounded"/>
        </xs:sequence>
     </xs:complexType>
  </xs:element>
  <xs:element name="Z">
     <xs:complexType>
        <xs:attribute ref="c1"/>
        <xs:attribute ref="c2" use="required" />
        <xs:attribute ref="c3" use="required" />
     </xs:complexType>
  </xs:element>
  <xs:attribute name="c1">
     <xs:annotation>
   <xs:appinfo>Action_needed</xs:appinfo>
   <xs:documentation>Action (Add/Update/Delete)</xs:documentation>
     </xs:annotation>
     <xs:simpleType>
     <xs:restriction base="xs:string">
      <xs:enumeration value="A"/>
      <xs:enumeration value="U"/>
      <xs:enumeration value="D"/>
     </xs:restriction>
     </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="c2">
     <xs:annotation>
   <xs:appinfo>Company ID</xs:appinfo>
   <xs:documentation>My Suppliers > Supplier Header > Name</xs:documentation>
     </xs:annotation>
        <xs:simpleType>
     <xs:restriction base="sqltypes:int"/>
      </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="c3">
     <xs:annotation>
   <xs:appinfo>Company Name</xs:appinfo>
   <xs:documentation>My Suppliers > Supplier Header > Name</xs:documentation>
     </xs:annotation>
        <xs:simpleType>
     <xs:restriction base="sqltypes:nvarchar">
     <xs:maxLength value="255"/>
            </xs:restriction>
      </xs:simpleType>
  </xs:attribute>
</xs:schema>


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>