Bookmark Topic Watch Topic
  • New Topic

Multiple root elements in XML schema

 
dinaker prasad
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have a question on multiple roots in a XML schema.

- IN xml schema <schema> element is the root element
now when we say its valid to have multiple roots in a xml schema , does this mean we can have more than one <schema> element in a XML schema file.

- in the below code
<xs:schema xmlns=""
tagetNamespace=""
elementFormDefault="qualified">

<xs:element name="transId" type="xs:string"/>
</schema>

transId i suppose is a global element, does this also mean as per schema it can be a the root element too. in this the case of multiple roots.

Thanks!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Report post to moderator
An XML document -- any XML document -- can only have one root element. This includes XML Schema documents, XHTML documents, XSL documents, everything. They all can have exactly 1 root element or they won't be parsed by any XML parser.

I didn't quite understand what you mean by the question about transId?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Since I noticed you have cross-posted this question to the XML forum as well, I'll close this one. Please avoid cross-posting. It's considered bad form in online forums such as ours.

Please continue the discussion over here.
 
    Bookmark Topic Watch Topic
  • New Topic