tksk / jing-trang

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

XSD output should handle xsi namespace sensibly #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Copy jing.jar, trang.jar, crimson.jar in a directory
2. Copy the attached XML file (File.xml) in the same directory
3. Open Command Prompt. Change directory so that you are in the same directory 
as the directory used in Step 1 and Step 2
4. Create XML Schema from attached XML file (File.xml) using following command 
java -cp trang.jar;jing.jar;crimson.jar 
com.thaiopensource.relaxng.translate.Driver -I xml -O xsd File.xml File.xsd
5. Observe the output files created in same folder. The schema file xsi.xsd is 
invalid - The {target namespace} of an attribute declaration must not match 
'http://www.w3.org/2001/XMLSchema-instance'.

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

What version of the product are you using? On what operating system?
jing-20091111
trang-20091111

Please provide any additional information below.

Original issue reported on code.google.com by ankitgoe...@gmail.com on 21 Dec 2010 at 6:19

Attachments:

GoogleCodeExporter commented 9 years ago
Probably should just strip out xsi:* attributes.

Original comment by jjc.jclark.com on 12 Jan 2011 at 4:21

GoogleCodeExporter commented 9 years ago
Fixing this issue would also solve my problem with the attached RNC schema, 
which allows Jing to validate the desired XML, also attached, but the xsi:type 
attribute messes up the conversion to XSD.

Deleting the xsi:type attribute produces an XSD which will validate the XML, 
including the datatype checking, so stripping the xsi:* attributes should work 
fine.

Original comment by taraAt...@gmail.com on 14 Feb 2011 at 7:25

Attachments:

GoogleCodeExporter commented 9 years ago
I have the same problem generating an XSD from an XML with Trang. It only 
validates after removing those two lines from the XSD (see examples attached, 
the example.xsd being generated and the example-fixed.xsd being fixed manually):

    <xs:import namespace="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="xsi.xsd"/>

    <xs:attribute ref="xsi:schemaLocation" use="required"/>

For reference: http://www.w3.org/TR/xmlschema-1/ 3.2.6 says the {target 
namespace} of an attribute declaration, whether local or top-level, must not 
match http://www.w3.org/2001/XMLSchema-instance (unless it is one of four 
built-in declarations).

Original comment by smile.in...@googlemail.com on 24 Aug 2011 at 9:54

Attachments:

GoogleCodeExporter commented 9 years ago
Hi ,

  I am also facing same issue for XML to XSD conversion.
Attached sample xml where ,
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="file:/C:/Users/Amruta%20Vispute/Documents/JTSpecXSD/X12-006040-850.xsd">

Here it is creating 2 xsd files :
 Apart from main xsd , creating xsi.xsd as below :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" 
targetNamespace="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <xs:import schemaLocation="x12_990_180215.xsd"/>
  <xs:attribute name="noNamespaceSchemaLocation" type="xs:anyURI"/>
</xs:schema>

Original comment by amruta.v...@gslab.com on 18 Feb 2015 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
Could a fix for this issue also address #186?

Original comment by uja...@gmail.com on 7 May 2015 at 10:35