relaxng / jing-trang

Schema validation and conversion based on RELAX NG
http://www.thaiopensource.com/relaxng/
Other
228 stars 69 forks source link

Feature request: various options controlling generation of local vs. global declarations #190

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In generating XML schemas from XML instance documents, trang creates global 
declarations for all elements and generalizes a type encompassing all the 
different instances of content found in the source documents.  In some 
contexts, further information is known out-of-band that would allow more 
desirable behavior for that context.  For example, if the XML documents are 
generated from JSON, there cannot be any mixed content, but there might be some 
elements with the same name where one contains only text and the other contains 
only elements.  If there were an option to trang to exclude the generation of 
complex types with mixed content, there would need to be two declarations for 
the identically-named elements subject to the constraints of the XML schema 
spec on when such elements may have different types.  Clearly no more than one 
of those declarations could be global.  Similarly, it might be known that the 
generated types could never be (mutually) recursive in the application context. 
 This would similarly result in multiple declarations if an option were 
provided to exclude these.  In general, more control over where local 
declarations could be made would be helpful (and the ability to produce local 
declarations, which does not appear to be present).

Original issue reported on code.google.com by jeff.gr...@gmail.com on 13 Nov 2014 at 9:44