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

Re: RelaxNG question


relax ng nons
Tim Bray wrote:

> Suppose in a RelaxNG schema (compact syntax) I have
> 
> default namespace eg = "http://example.com/"
> namespace noNS = ""
> 
> I'm writing a schema for something that will serve as a container, and I 
> have an element for which I want to say "This can contain mixed content 
> of more or less any elements/attributes with the constraint that no 
> elements may be unqualified (noNS above), and no elements or attributes 
> can be in my namespace ("eg" above).

You've got three kinds of elements here:

1) container elements in the eg namespace
2) children of container elements; let's call these border elements
3) descendants of the border elements; let's call these interior elements

If I have understood correctly, you want border elements not to be 
unqualified and not to be in the eg namespace.  What about interior 
elements? I suspect you *do* want to allow those to be unqualified. 
Assuming:

- container elements must not have any unqualified attributes
- container elements must not have any attributes in the eg namespace
- border elements must not have attributes in the eg namespace
- border elements must not be in the eg namespace
- border elements must not be unqualified
- interior elements must not have attributes in the eg namespace
- interior elements must not be in the eg namespace
- interior elements may be unqualified

you could write the schema like this:

namespace eg = "http://www.example.com"
namespace noNS = ""

interior =
    element * - eg:* {
      attribute * - eg:* { text }*,
      (interior|text)*
    }

border =
    element * - (eg:*|noNS:*) {
      attribute * - eg:* { text }*,
      (interior|text)*
    }

container =
    element eg:container {
      attribute * - (eg:*|noNS:*) { text }*,
      (border|text)*
    }

James


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.