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

Re: Help creating DTD


dtd language
Schematron is another schema language. It lets you take your 
natural language statements and wrap them with XPath-based
tests.  

Here is the description:
 <ORDER> can contain any number of child elements
 <UID> must be included
 <DEALER> must be included
 <ORDERS> must be included

<ORDERS> can contain multiple ITEM(s) but restricted to just ITEM nodes
<ITEM> must have unique id property and the value of item must be numeric > 0

Here is a Schematron schema for those:

<schema xmlns="http://www.ascc.net/xml/schematron">
 <title>Example Schema</title>
 <pattern name="Contents">

  <rule context="ORDER">
   <assert test="true()" >ORDER can contain any number of child elements</assert>
   <assert test="UID" >UID must be included</assert>
   <assert test="DEALER" >DEALER must be included</assert>
   <assert test="ORDERS" >ORDERS must be included</assert>
  </rule>

  <rule context="ORDERS">
   <assert test="count(*) = count(ITEM)"
       >ORDERS can contain multiple ITEM(s) but restricted to just ITEM nodes
   </assert>
  </rule>

  <rule context="ITEM">
   <assert test="count(//ITEM[@id=current()/@id]) = 1" >
       ITEM must have unique id property</assert>
   <assert test="./number() &gt; 0 ">
       The value of ITEM must be numeric > 0</assert>
  </rule>

 </pattern>
</schema>

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.