[relaxng-user] xsd2rng

Tom Gaven Tom.Gaven at exostar.com
Wed Dec 10 16:20:36 ICT 2003


Hi Bruce,
   
Not that this is "better", but an alternative of:

...
    | element extension {mixed { element0+ } }
    | recordInfo)+

element0 =
   element * {
     mixed {
       (element0
        | attribute * { text })*
     }
   }

Might be:
...
   | element extension { anyElementOrText }
   | recordInfo)+

anyElementOrText = element *  { attribute * { text } | text |
anyElementOrText }*

Also, you probably don't need your element1 define, it looks like it's the
same as element0.

AFAIK, RNG doesn't have an 'any' pattern, which might make your expression
simpler, but why clutter up the syntax?  It's perfect as is!
  

tom
 

-----Original Message-----
From: Bruce D'Arcus [mailto:bdarcus at fastmail.fm] 
Sent: Wednesday, December 10, 2003 1:48 PM
To: relaxng-user at relaxng.org
Subject: [relaxng-user] xsd2rng


OK, going back to my MODS schema example, which I've converted to RNG 
with the Sun conversion tool.  Unfortunately, it strips the 
documentation and results in some odd (though workable) code in places.

Here's is how the extension element -- designed to allow foreign 
namespaced content -- is defined in the xsd file:

	<xsd:complexType name="extensionType" mixed="true">
		<xsd:annotation>
			<xsd:documentation>use for local extensions or for
extensions from 
other XML schemas</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:any processContents="skip"
maxOccurs="unbounded"/>
		</xsd:sequence>
	</xsd:complexType>

Full schema at:

	http://www.loc.gov/standards/mods/v3/mods-3-0.xsd

And following is how it was transformed to RNG.  I've cleaned this up a 
bit, and posted it here:

	http://www.users.muohio.edu/darcusb/files/mods-3-0.rnc

Is there not a better way to represent the above in RNG?

    | element extension {
           mixed { element0+ }
         }
    | recordInfo)+

==========

"element0" defined as so:

============

element0 =
   element * {
     mixed {
       (element0
        | attribute * { text })*
     }
   }
element1 =
   element * {
     mixed {
       (attribute * { text }
        | element1)*
     }
   }

_______________________________________________
relaxng-user mailing list
relaxng-user at relaxng.org http://relaxng.org/mailman/listinfo/relaxng-user


More information about the relaxng-user mailing list