开发者

How to get list of elements from XSOM parser

开发者 https://www.devze.com 2023-03-19 19:05 出处:网络
With XSOM, how can I obtain information for elements from a sample schema? (see below) I\'ve been trying to use the iterateElementDecls() method but only can obtain the top element (note).

With XSOM, how can I obtain information for elements from a sample schema? (see below)

I've been trying to use the iterateElementDecls() method but only can obtain the top element (note).

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">

<xs:element name="note">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="to" type="x开发者_高级运维s:string"/>
      <xs:element name="from" type="xs:string"/>
      <xs:element name="heading" type="xs:string"/>
      <xs:element name="body" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

</xs:schema>


You have to navigate to complex type then you repeat the same method to get all elements inside the complex type definition.

Hope that helps :)

0

精彩评论

暂无评论...
验证码 换一张
取 消