Why do I get this error?

This should cover W3C XML Schema, Relax NG and DTD related problems.
cschlaefcke
Posts: 3

Why do I get this error?

Wed Oct 06, 2004 3:03 pm

Hi Folks,

when I try to generate an schema from an existing xml file it creates the xsd file and additional the file "xsixsd". When I open the xsixsd file (I´m using the eclipse 2.1 plugin) it shows an validation error that I don´t understand:

no-xsi: The {target namespace} of an attribute declaration must not match 'http://www.w3.org/2001/XMLSchema-instance'. SystemID: file:/C:/workspace/mapping/xsixsd
Line: 4
xsixsd mapping line 4

This ist what the xsixsd file contains:
<?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="kunde.xsd"/>
<xs:attribute name="noNamespaceSchemaLocation" type="xs:NCName"/> <!-- ERROR in this Line -->
</xs:schema>

Thanks & Regards,

Chris
george
Site Admin
Posts: 2100

Wed Oct 06, 2004 3:32 pm

Hi Chris,

Oxygen uses TRANG [1] for generating an XML Schema from an instance document. It seems that TRANG does not ignore the schema insstance attributes used to associate an XML Schema to an instance document. You have two options further:

1. Remove the xsi:noNamespaceSchemaLocation from your instance document before you run the conversion.
2. Remove the import of the schema instance namespace
<xs:import namespace="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="xsixsd"/>
and the attribute reference from your root element:
<xs:attribute ref="xsi:noNamespaceSchemaLocation" use="required"/>

BTW, why do you need to generate a schema if you already have one set on the document ?

[1] http://www.thaiopensource.com/relaxng/trang.html

Best Regards,
George
cschlaefcke
Posts: 3

Wed Oct 06, 2004 4:11 pm

george wrote:Hi Chris,
BTW, why do you need to generate a schema if you already have one set on the document ?


I made it like this, because I first tried to do the xsd stuff by hand :oops:
This was before I installed oxygen and the complexity of xsd nearly drove my nuts :D
So I already had a test xsd that I tried to use without any success, before I found the tranformation feature of oxygen.

What is the recommended way? Straight XML without any xsd in it and then transforming it?

Regards,

Chris
george
Site Admin
Posts: 2100

Wed Oct 06, 2004 4:40 pm

Hi Cris,

Yes, that will be better.

Best Regards,
George
cschlaefcke
Posts: 3

Wed Oct 06, 2004 4:54 pm

george wrote:Hi Cris,

Yes, that will be better.

Best Regards,
George


Thank you! It´s working now!

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests