[relaxng-user] xsd2rng

Bruce D'Arcus bdarcus at fastmail.fm
Wed Dec 10 13:47:45 ICT 2003


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)*
     }
   }



More information about the relaxng-user mailing list