RE: xsd2rng

Tom Gaven <[email protected]>
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
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:[email protected]] 
Sent: Wednesday, December 10, 2003 1:48 PM
To: [email protected]
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
[email protected] http://relaxng.org/mailman/listinfo/relaxng-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.