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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Relax-NG schema design question

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Relax-NG schema design question
  • From: Lars Oppermann <Lars.Oppermann@Sun.COM>
  • Date: Tue, 30 Nov 2004 10:49:03 +0100
  • Organization: Sun Microsystems Inc.
  • User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)

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@sun.com>               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




 

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

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