hanshuebner / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

Trang generates illegal XSD from RNG #81

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Attached is an RNG schema for an XML document that has different content models 
for two appearances of the 
element 'a':

<root>
 <a><r/><s/></a>
 <a><t/><u/></a>
</root>

Trang 2008-10-28 generates the attached XSD. Validating the above XML with the 
Java 6 JAXP API gives:

org.xml.sax.SAXParseException: cos-element-consistent: Error for type 
'#AnonType_root'. Multiple elements 
with name 'a', with different types, appear in the model group.

XML Schema probably cannot describe this content model (at least, I don't know 
how), but it would be nice 
if trang either reported an error during translation or (much more complicated, 
probably) had an option for 
generating a combined content model for the 'a' element.

Regards,

Jay

Original issue reported on code.google.com by uja...@gmail.com on 16 Jun 2009 at 7:54

Attachments:

GoogleCodeExporter commented 9 years ago
Indeed, XSD cannot represent this schema.  It's a rule in XSD that if you know 
the name of an element and the type of its parent element, then the type of the 
element is fixed.  (By contrast, in DTDs you only need to know the name of the 
element to fix its content model, and in RNG you need to know the content 
models of all ancestral elements.) 

Original comment by johnwco...@gmail.com on 22 Feb 2014 at 8:38