PLEASE PLEASE HELP - Castor porblem

From: Gandu (cpptutor2000_at_yahoo.com)
Date: 01/12/04

  • Next message: Xavier Tarrago: "Re: Java Web Start won't launch rich client"
    Date: 11 Jan 2004 22:16:35 -0800
    
    

    I am a newbie to Castor. I downloaded all the jar files, made changes
    to the classpath etc, but I keep on getting exceptions being thrown.

    The XML schema file is as follows:
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:element name="catalog">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="book" minOccurs="0" maxOccurs="unbounded">
              <xsd:complexType>
                <xsd:sequence>
                  <xsd:element name="author" type="xsd:string"/>
                  <xsd:element name="title" type="xsd:string"/>
                  <xsd:element name="genre" type="xsd:string"/>
                  <xsd:element name="price" type="xsd:float"/>
                  <xsd:element name="publish_date" type="xsd:date"/>
                  <xsd:element name="description" type="xsd:string"/>
                </xsd:sequence>
                <xsd:attribute name="id" type="xsd:string"/>
               </xsd:complexType>
              </xsd:element>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>

    If I type in:
    C:\>java org.exolab.castor.builder.SourceGenerator -i
    C:\\Temp\\Test.xsd

    I get the error message:
    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(UnmarshalHandler.java: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(Unknown
    Source)
            at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown
    Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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.XML11Configuration.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.loadMapping(Mapping.java:441)
            at org.exolab.castor.xml.schema.SimpleTypesFactory.loadTypesDefinitions(SimpleTypesFactory.java:414)
            at org.exolab.castor.xml.schema.SimpleTypesFactory.getType(SimpleTypesFactory.java:380)
            at org.exolab.castor.xml.schema.SimpleTypesFactory.getBuiltInType(SimpleTypesFactory.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.TypeReference.resolveTypeReference(TypeReference.java:113)
            at org.exolab.castor.xml.schema.TypeReference.getType(TypeReference.java:69)
            at org.exolab.castor.xml.schema.ElementDecl.getType(ElementDecl.java:327)
            at org.exolab.castor.xml.schema.ElementDecl.validate(ElementDecl.java:743)
            at org.exolab.castor.xml.schema.Group.validate(Group.java:471)
            at org.exolab.castor.xml.schema.ComplexType.validate(ComplexType.java:795)
            at org.exolab.castor.xml.schema.ElementDecl.validate(ElementDecl.java:748)
            at org.exolab.castor.xml.schema.Group.validate(Group.java:471)
            at org.exolab.castor.xml.schema.ComplexType.validate(ComplexType.java:795)
            at org.exolab.castor.xml.schema.ElementDecl.validate(ElementDecl.java:748)
            at org.exolab.castor.xml.schema.Schema.validate(Schema.java:1466)
            at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:312)
            at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:394)
            at org.exolab.castor.builder.SourceGenerator.generateSource(SourceGenerator.java:425)
            at org.exolab.castor.builder.SourceGenerator.main(SourceGenerator.java:760)

    Any help would be greatly appreciated. Thanks in advance for your
    help.


  • Next message: Xavier Tarrago: "Re: Java Web Start won't launch rich client"

    Relevant Pages

    • Re: Constellations
      ... You want a set of dirs, with exceptions, and exceptions to the ... only XML. ... expressed using XML or that expressing the list using a combination of ...
      (comp.lang.java.programmer)
    • Re: Constellations
      ... You want a set of dirs, with exceptions, and exceptions to the ... only XML. ... expressed using XML or that expressing the list using a combination of ...
      (comp.lang.java.programmer)
    • Re: XML Parser in EVC++ 4.0
      ... parser, the customer, who was using the MSXML parser, would see a ... Do you mean that it just fails to keep parsing the data ... on you (and not just the spurios messages about it throwing exceptions ... If you really want to be able to parse any garbage XML thrown at you (or as ...
      (microsoft.public.windowsce.embedded.vc)
    • Re: XML Cleaner
      ... call sender.Skipbecause due to a bug in v1.x, it's not set to the reader ... Daniel Cazzulino [MVP XML] ... I'm> looking to develop a tool that will run an XML file against an XSD> schema and if a node doesn't conform to the schema, ... > The code to validate against the schema is strightforward, but how do I> use the exceptions thrown by the XmlValidatingReader to clean the XML file? ...
      (microsoft.public.dotnet.xml)
    • problem compiling project, classpath in xml ".classpath" ""
      ... problem compiling project, classpath in xml ".classpath" ... i'm trying to compile a project, it has about 70 jar files. ... Various parent directories have ".classpath" files ...
      (comp.lang.java.programmer)