Castor Exception : The prefix 'xml' is reserved

C

Christophe Geraud

I got the following exception with Castor: "The prefix 'xml' is reserved
(XML 1.0 Specification) and cannot be declared."
I got this exception using or not a mapping file.
Can anyone tell what it means ?

Here is the stack trace :

java.lang.IllegalArgumentException: The prefix 'xml' is reserved (XML 1.0
Specification) and cannot be declared.

at org.exolab.castor.xml.Namespaces.addNamespace(Namespaces.java:130)

at
org.exolab.castor.xml.UnmarshalHandler.startPrefixMapping(UnmarshalHandler.j
ava:1953)

at
org.apache.xerces.parsers.AbstractSAXParser.startNamespaceMapping(Unknown
Source)

at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)

at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unkno
wn Source)

at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElem
entHook(Unknown Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown Source)

at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)

at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:583)

at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:515)

at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:468)

at org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:395)

at Test.main(Test.java:41)

Exception in thread "main"
 
K

Koen

I've got exactly the same error.

Any solution outthere
Here's my xml schema

<?xml version="1.0"?>
<xsd:schema version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:simpleType name="Double3to40">
<xsd:restriction base="xsd:decimal">
<xsd:fractionDigits value="2"></xsd:fractionDigits>
<xsd:minInclusive value="3"/>
<xsd:maxInclusive value="40"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Int0to99">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="99"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Int0to999">
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="999"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="StringMax24">
<xsd:restriction base="xsd:string">
<xsd:maxLength value="24"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:attribute name="LineType">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Normal"/>
<xsd:enumeration value="Curved"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:simpleType name="OnOff">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="On"/>
<xsd:enumeration value="Off"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="Argument0to4">
<xsd:simpleContent>
<xsd:restriction base="AttribEventID">
<xsd:maxInclusive value="4"/>
</xsd:restriction>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="AttribEventID">
<xsd:simpleContent>
<xsd:extension base="xsd:nonNegativeInteger">
<xsd:attribute name="EventID"
type="xsd:positiveInteger" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="UnitEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Metric"/>
<xsd:enumeration value="Imperial"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LanguageEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="English"/>
<xsd:enumeration value="French"/>
<xsd:enumeration value="German"/>
<xsd:enumeration value="Dutch"/>
<xsd:enumeration value="Spanish"/>
<xsd:enumeration value="Portugese"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SensorEnum">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="1/3"/>
<xsd:enumeration value="1/2"/>
<xsd:enumeration value="2/3"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="Coordinates">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="4"
name="Point" type="Point"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Point">
<xsd:sequence>
<xsd:element name="xval">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:minInclusive value="15"/>
<xsd:maxInclusive value="695"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="yval">
<xsd:simpleType>
<xsd:restriction base="xsd:positiveInteger">
<xsd:minInclusive value="15"/>
<xsd:maxInclusive value="305"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
<xsd:attribute default="Normal" ref="LineType"
use="optional"/>
</xsd:complexType>
<xsd:element name="PARAMETERS">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="General">
<xsd:complexType>
<xsd:all>
<xsd:element name="DayLightSavingsTime">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="OnOff">
<xsd:attribute default="4"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Unit">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="UnitEnum">
<xsd:attribute default="4"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="VideoLevel">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="Int0to99">
<xsd:attribute default="4"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Address">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="Int0to99">
<xsd:attribute default="4"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Language">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="LanguageEnum">
<xsd:attribute default="4"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="CamName">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="StringMax24">
<xsd:attribute default="2"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="Calibration">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SensorType"
type="SensorEnum"/>
<xsd:element name="CameraHeigth">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension
base="Double3to40">
<xsd:attribute default="3"
name="UserLevel"

type="xsd:positiveInteger" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="FocalDistance">
<xsd:simpleType>
<xsd:restriction
base="xsd:double">
<xsd:minInclusive
value="2.00"/>
<xsd:maxInclusive
value="60.00"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Zone">
<xsd:complexType>
<xsd:sequence>
<xsd:element
name="Coordinates" type="Coordinates"/>
<xsd:element name="Length">
<xsd:simpleType>
<xsd:restriction
base="xsd:double">
<xsd:minInclusive
value="0"/>
<xsd:maxInclusive
value="1000"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:unique name="NoDuplicatePoints">
<xsd:selector
xpath="Coordinates/Point"/>
<xsd:field xpath="xval"/>
<xsd:field xpath="yval"/>
</xsd:unique>
</xsd:element>
</xsd:sequence>
<xsd:attribute default="4" name="UserLevel"
type="xsd:positiveInteger" use="optional"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ForceEvents">
<xsd:complexType>
<xsd:sequence>
<xsd:element
name="QueueEvent">
<xsd:complexType>
<xsd:sequence>
<xsd:element
maxOccurs="8" minOccurs="8"
name="QEvent"
type="Argument0to4"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute default="3" name="UserLevel"
type="xsd:positiveInteger" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Language"
type="xsd:positiveInteger"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>


If I simplify it works, so somethings unsupported i think

<?xml version="1.0"?>
<xsd:schema version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="PARAMETERS">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="General"/>
<xsd:element name="Calibration"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top