Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dumb Newbie XSD Question

Status
Not open for further replies.

Oblivia

Programmer
Jan 14, 2007
2
US
Hi -
As you can probably tell from the subject line, I'm totally new to some of the more complicated XML stuff. Here's my question: if you have an XSD, and a corresponding XML file, how can you tell which is the root element of the document? I mean, yeah, I can tell by looking at it, but how did it know which element to pick as the root?!?![ponder]
 
XML syntax rules dictate that XML documents must have a root element i.e. all XML documents must contain a single tag pair to define a root element. All other elements must be within this root element (
I believe the structure of an XML document means that the opening tag for the root element must be the second line of text (i.e. the first line after the XML declaration).



Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Thanks, Stretchwickster. My question was really directed toward the XSD file: I have a bunch of groups and complexType definitions followed by an alphabetized (by element-name) list of elements at the end, but nothing that says one of those should be the root. Example: say I have the following at the end of my file --
<xsd:element name="animal" type="SomeComplexType" />
<xsd:element name="duck" type="SomeComplexType" />
<xsd:element name="goose" type="SomeComplexType" />

I can tell from looking at an XML file that "animal" is supposed to be the root. Without that example, though, how am I supposed to know? Or can any of them be a root?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top