tksk / jing-trang

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

Conversion to XSD does not remove definitions that have been overridden #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reproducing the problem:

1. Create two .rnc files, 'library.rnc' and 'main.rnc'. 
2. Include 'library.rnc' from 'main.rnc' and redefine an element which was 
in 'library.rnc'.
3. Run 'trang main.rnc main.xsd'.

Problem details:

The produced 'main.xsd' file includes 'library.xsd' using the 'xs:include' 
element rather than the 'xs:redefine' element. The resulting file is 
therefore a malformed schema because an element is defined twice but not 
correctly redefined.

A correct translation would include the file using the 'xs:redefine' 
element, and include the overriding declarations inside of that element.

The defect occurs in version 20081028.

Notes:

This defect makes it very difficult to create modular schema families when 
those schemas must be converted to xsd for use.

Thanks.

-Jonathon Duerig

Original issue reported on code.google.com by tyrec...@gmail.com on 12 Nov 2008 at 1:16

GoogleCodeExporter commented 9 years ago
Please attach small example files library.rnc and main.rnc that demonstrate the 
problem.

Original comment by jjc.jclark.com on 12 Nov 2008 at 2:38

GoogleCodeExporter commented 9 years ago
At the moment what it is supposed to do is to remove the redefined element from
library.xsd, so that the generated schema is valid.  If it doesn't, then that's 
a
bug, but I need an example to fix it.  Generating redefine would be a nice
enhancement (which is in the trang todo list). 

Original comment by jjc.jclark.com on 12 Nov 2008 at 2:50

GoogleCodeExporter commented 9 years ago
After trying to reproduce it on a small example, I have discovered that the 
true 
problem I was having was something else entirely.

I have a family of related schemas, call them 'a.rnc' and 'b.rnc'. And each one 
uses 
some parts in common which are included from 'common.rnc' with some 
redefininitions.

When I run 'trang a.rnc a.xsd', it creates a 'common.xsd' without the 
redefinitions 
from 'a.xsd'. When I run 'trang b.rnc b.xsd', it creates a new 'common.xsd' and 
overwrites the previous one. But the new 'common.xsd' includes some things 
which 
were redefined in 'a.xsd'. So now 'a.xsd' includes the wrong version of 
'common.xsd' 
and breaks.

Now that I fully understand the problem, I have a workaround. But an output 
option 
to either (a) combine includes into one output file or (b) add some kind of 
prefix 
to outputs would be very useful in this circumstance.

-Jonathon Duerig

Original comment by tyrec...@gmail.com on 12 Nov 2008 at 7:02

GoogleCodeExporter commented 9 years ago
I see the problem.  <redefine> might help, but I suspect that even with redefine
there will be cases where the same input file would have different translations 
when
included in different contexts. I added issue 51 for your suggestion of an 
option to
combine includes, because I think this would be useful in several contexts. 
Feel free
to comment on that, if it doesn't capture what you're looking for, or add 
another
issue for your (b) suggestion.

Original comment by jjc.jclark.com on 13 Nov 2008 at 12:13