XML Schemas (SOM) - Finding order of elements

B

Bardo

Hi all,

I am a newbie to using the XML Schema Object Model (SOM) and would like a
few pointers on how to perform a particular task.
I am essentially trying to search for elements/attributes via the SOM as
they appear in a visual XML editor (as in the tree view).
I need to be able to:
1. Start by finding the "root node" of the schema. I.e. the complex type
that contains references to all other types.
2. Move to each nested complex type in the order in which they appear in the
tree.
For example, I have a schema that defines an instance document that looks
like:

<RootNode>
<Child1>
<Child1_01>
<Child1_02>
</Child1>
<Child2>
<Child2_01>
<Child2_02>
</Child2>

I need to be able to load the schema from file, seek to "RootNode".
Then I should be able to determine that "Child1" is the first immediate
child of "RootNode".
From there I should be able to determine that "Child1_01" is the first
immediate child of "Child1", etc. etc.
"Child1" is also defined with a ref="Child1_01" as "Child1_01" is also a
complex type. I am assuming there is some way through the API to follow
through to the references of the element.

Any pointers much appreciated.
I hope I have explained well enough!

Cheers,

Bardo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top