Relax-NG schema design question
Hi folks, I'm working on the OpenDocument (OpenOffice) format specification. We are using RelaxNG for our schema and recently semm to have discovered a flaw in our schema which some validators don't regard as a flaw (e.g. sun multi schema validator (2003-02-25) and jing (2003-06-19)), but others do (e.g. xmllint (libxml2-2.6.16)). We are using attributes, which contain a list of values. The type of those values is referenced rather then defined every time it is used. E.g.: <define name="draw-enhanced-geometry-attlist" combine="interleave"> <optional> <attribute name="draw:extrusion-depth" a:defaultValue="36pt 0"> <list> <ref name="length"/> <ref name="double"/> </list> </attribute> </optional> </define> Where for example length is defined elsewhere as <define name="length"> <data type="string"> <param name="pattern"> -?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px)) </param> </data> </define> Only the fact, that xmllint reported "element ref: Relax-NG parser error: Found forbidden pattern list//ref" made us aware of the fact, that relax-ng in fact constraints the use of refs in lists. (http://books.xmlschemata.org/relaxng/ch17s02.html#id2877724) I do see the reason for the contraint, but what would be the right way to define such structures? Repeating the pattern every time the ref was used would solve the error, but would mess up the design quite a bit, since there wouldn't be a central place where types like length could be maintained. So if one decided to at e.g. 'ft' to the pattern, all occurences would have to be updated. I'm new to relax-ng and I hope I'm just missing something obvious here. I'm also not quite sure what I should make of the fact, that some validators Bests, ~Lars -- Lars Oppermann <lars.oppermann@s...> Sun Microsystems Software Engineer - StarOffice Sachsenfeld 4 Phone: +49 40 23646 959 D-20097 Hamburg Fax: +49 40 23646 550 http://www.sun.com/staroffice
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format