[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: wanting advice on finding out the root element in a w3c schema

  • From: Rick Jelliffe <ricko@a...>
  • To: xml-dev@l...
  • Date: Thu, 30 Aug 2001 15:25:05 +1000

finding out the document root
There is no way to determine the root element of a document from
a W3C XML Schema schema.

Any element definition in an XML schema (not being a local one) 
could be used as the top level of an element (or the top-level of 
a branch of that namespace.)

You can find possible tops of branches.  But wildcards and other recursion
needed to be coped with too.

If you want to specify the root element of a document, you can use a 
Schematron schema like the following:
<schema xmlns="http://www.ascc.net/xml/schematron" >
     <pattern>
          <rule context = "/*">
               <assert test = "/myelement">Root element should be "myelement".</assert>
          </rule>
     </pattern>
</schema>

You can also specify that some elements may not appear except as children
of the same namespace.

     <pattern>
          <rule context = "ns1:e1 | ns1:e2 | ns1:e3 ">
               <assert test = "../ns1:*">e1, e2, and e3 must appear as children of 
              an element in the same namespace.</assert>
          </rule>
     </pattern>

Cheers
Rick Jelliffe


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.