This is a known problem - details of the workround are here:

http://www.mail-archive.com/castor-dev%40exolab.org/msg15353.html
 
(This worked when I had the same problem)
 
Alison

-----Original Message-----
From: James Yu [mailto:[EMAIL PROTECTED]
Sent: 14 November 2003 15:18
To: [EMAIL PROTECTED]
Subject: [castor-dev] Why I get this exception under J2SDK version 1.4.2-02? - butI tried J2sdk version 1.3.1 is ok.

My OS: Microsoft Windows XP [Version 5.1.2600]  (C) Copyright 1985-2001 Microsoft Corp.
 
my java home and version: d:\j2sdk14202 
                               J2SDK: version 142_02-b03

set classpath=d:\j2sdk14202\lib;.;d:\castor\castor-0.9.5.2-xml.jar;d:\castor\xerces-J_1.4.0.jar
 
D:\castor>sourceGen -i command-config.xsd -package mytt
Exception in thread "main" 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(UnmarshalHa
ndler.java:1953)
        at org.apache.xerces.parsers.AbstractSAXParser.startNamespaceMapping(Abs
tractSAXParser.java:1867)
        at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXP
arser.java:418)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidat
or.java:778)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen
t(XMLDocumentFragmentScannerImpl.java:823)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanR
ootElementHook(XMLDocumentScannerImpl.java:1028)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1610)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM
LDocumentFragmentScannerImpl.java:348)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:539)
        at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.jav
a:595)
        at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.j
ava:1125)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:583)
        at org.exolab.castor.mapping.Mapping.loadMappingInternal(Mapping.java:51
5)
        at org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:441)
        at org.exolab.castor.xml.schema.SimpleTypesFactory.loadTypesDefinitions(
SimpleTypesFactory.java:414)
        at org.exolab.castor.xml.schema.SimpleTypesFactory.getType(SimpleTypesFa
ctory.java:380)
        at org.exolab.castor.xml.schema.SimpleTypesFactory.getBuiltInType(Simple
TypesFactory.java:202)
        at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:919)
        at org.exolab.castor.xml.schema.Schema.getSimpleType(Schema.java:858)
        at org.exolab.castor.xml.schema.SimpleTypeReference.resolveTypeReference
(SimpleTypeReference.java:102)
        at org.exolab.castor.xml.schema.SimpleTypeReference.getType(SimpleTypeRe
ference.java:92)
        at org.exolab.castor.xml.schema.AttributeDecl.getSimpleType(AttributeDec
l.java:255)
        at org.exolab.castor.builder.SourceFactory.processAttributes(SourceFacto
ry.java:1276)
        at org.exolab.castor.builder.SourceFactory.processComplexType(SourceFact
ory.java:1368)
        at org.exolab.castor.builder.SourceFactory.createSourceCode(SourceFactor
y.java:393)
        at org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerat
or.java:911)
        at org.exolab.castor.builder.SourceGenerator.createClasses(SourceGenerat
or.java:811)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
tor.java:335)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
tor.java:394)
        at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenera
tor.java:425)
        at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:7
60)
===========================================================================
The XML schema file is as following:
 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
 <xs:element name="CommandMapping">
  <xs:complexType>
   <xs:attribute name="name" type="xs:string"/>
   <xs:attribute name="receiver" type="xs:string"/>
   <xs:attribute name="method" type="xs:string"/>
   <xs:attribute name="type" type="xs:string"/>
   <xs:attribute name="target" type="xs:string"/>
  </xs:complexType>
 </xs:element>
 <xs:element name="commandConfig">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="targets"/>
    <xs:element ref="commands"/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
 <xs:element name="commands">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="CommandMapping" maxOccurs="unbounded"/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
 <xs:element name="target">
  <xs:complexType>
   <xs:attribute name="name" type="xs:string"/>
   <xs:attribute name="ejb" type="xs:string"/>
   <xs:attribute name="type" type="xs:string"/>
   <xs:attribute name="contextFactory"/>
   <xs:attribute name="url" type="xs:string"/>
   <xs:attribute name="lookupName" type="xs:string"/>
   <xs:attribute name="remote" type="xs:boolean"/>
  </xs:complexType>
 </xs:element>
 <xs:element name="targets">
  <xs:complexType>
   <xs:sequence>
    <xs:element ref="target" maxOccurs="unbounded"/>
   </xs:sequence>
  </xs:complexType>
 </xs:element>
</xs:schema>
 

Reply via email to