Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple root elements in XML schema

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic