OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Quick RelaxNG question

[ Lists Home | Date Index | Thread Index ]

Sean McGrath wrote:

> Can anybody point me to a way of expressing an open content model with 
> RelaxNG?
> 
> I.e. no restictions on contents of element Foo other than that the 
> content of Foo is well formed. A bit like ANY is XML 1.0 but without

> the restriction of having to declare all element types.


No problem: you just need to say what you want.  Such an element
has a content model consisting of:

	1) any number of attributes with text content and
	2) any number of sub-elements with model ANY interleaved with
	3) arbitrary text.

In NX syntax that would be:

ANY =   attribute * {text}* &
         element * {ANY}* &
         text

to which we can add a concrete element for testing:

start = element catchbin {ANY}

which taken jointly translate to standard syntax thus:

<?xml version="1.0" encoding="ISO-8859-1"?>
<grammar xmlns="http://relaxng.org/ns/structure/0.9";>
   <define name="ANY">
     <interleave>
       <zeroOrMore>
         <attribute>
           <anyName/>
           <text/>
         </attribute>
       </zeroOrMore>
       <zeroOrMore>
         <element>
           <anyName/>
           <ref name="ANY"/>
         </element>
       </zeroOrMore>
       <text/>
     </interleave>
   </define>
   <start>
     <element name="catchbin">
       <ref name="ANY"/>
     </element>
   </start>
</grammar>

-- 
Not to perambulate             || John Cowan <jcowan@reutershealth.com>
    the corridors               || http://www.reutershealth.com
during the hours of repose     || http://www.ccil.org/~cowan
    in the boots of ascension.  \\ Sign in Austrian ski-resort hotel





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS