relaxng / jing-trang

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

conversion to XSD corrupted required nodes become optional #137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create test.rnc file:
test.a = element x { text } & element y { text }
start = element test { 
  element a { test.a },
  element b { ( test.a ) },
  element c { element x { text } & element y { text } }
}

2. convert to xsd:
java -jar trang-20091111\trang.jar -I rnc -O xsd test.rnc test.xsd

3. create xml file:
<test>
  <a></a>
  <b></b>
  <c><x/><y/></c>
</test>

4. validate xml against .rnc and .xsd

What is the expected output? What do you see instead?

Jing produces the expected output:
C:\SVN\modsw\sandbox\ia9_xml\tools\test.xml:2:10: error: element "a" 
incomplete; missing required elements "x" and "y"
C:\SVN\modsw\sandbox\ia9_xml\tools\test.xml:3:10: error: element "b" 
incomplete; missing required elements "x" and "y"

Validation against xsd gives no errors (tried with xerces-c-3.1.1 and Visual 
Studio 2008) this is because requred x- and y nodes have been changed to 
optional in conversion from RNC to XSD

What version of the product are you using? On what operating system?
Windows 7 64bit
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)

Original issue reported on code.google.com by henri.se...@gmail.com on 25 Feb 2011 at 8:55