Hello,

 

I regret my the previous incomplete post.

 

Got the following exception while generating the source code for the
web-app_2_5.xsd using org.exolab.castor.builder.SourceGeneratorMain with
the following options.

 

-package com.anttools.xml.schema.webapp -fail -verbose -i
web-app_2_5.xsd -f -types j2 -binding-file build/bindingWebApp.xml -dest
build/generated/webapp/src"

 

Exception:

 

     [java] -- Suppressing non fatal warnings.

     [java] org.exolab.castor.xml.XMLException: An annotation must
appear as the

 first child of 'complexType' elements.

     [java]     at
org.exolab.castor.xml.schema.reader.ComponentReader.error(Com

ponentReader.java:193)

     [java]     at
org.exolab.castor.xml.schema.reader.ComplexTypeUnmarshaller.s

tartElement(ComplexTypeUnmarshaller.java:445)

     [java]     at
org.exolab.castor.xml.schema.reader.SchemaUnmarshaller.startE

lement(SchemaUnmarshaller.java:484)

     [java]     at
org.exolab.castor.xml.schema.reader.Sax2ComponentReader.start

Element(Sax2ComponentReader.java:255)

     [java]     at
org.apache.xerces.parsers.AbstractSAXParser.startElement(Unkn

own Source)

     [java]     at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSta

rtElement(Unknown Source)

     [java]     at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragmen

tContentDispatcher.dispatch(Unknown Source)

     [java]     at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDoc

ument(Unknown Source)

     [java]     at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown So

urce)

     [java]     at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown So

urce)

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

     [java]     at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Sou

rce)

     [java]     at
org.exolab.castor.builder.SourceGenerator.generateSource(Sour

ceGenerator.java:613)

     [java]     at
org.exolab.castor.builder.SourceGenerator.generateSource(Sour

ceGenerator.java:548)

     [java]     at
org.exolab.castor.builder.SourceGeneratorMain.main(SourceGene

ratorMain.java:309)

     [java] org.castor.core.exceptions.CastorRuntimeException: Source
Generator:

 schema parser threw an Exception

     [java]     at
org.exolab.castor.builder.SourceGenerator.generateSource(Sour

ceGenerator.java:638)

     [java]     at
org.exolab.castor.builder.SourceGenerator.generateSource(Sour

ceGenerator.java:548)

     [java]     at
org.exolab.castor.builder.SourceGeneratorMain.main(SourceGene

ratorMain.java:309)

     [java] Caused by: org.exolab.castor.xml.XMLException: An annotation
must ap

pear as the first child of 'complexType' elements.

     [java]     at
org.exolab.castor.xml.schema.reader.Sax2ComponentReader.start

 

 

 

Binding webapp.xml:

 

<?xml version="1.0"?>

<!-- This file contains the binding information -->

<!-- for the invoice XML Schema -->

<!-- It is meant to be used by the Castor Source Code Generator -->

<cbf:binding xmlns:cbf="http://www.castor.org/SourceGenerator/Binding";
defaultBindingType="element">

     

     <!-- Binding the web-app element to a class -->

     <cbf:elementBinding name="web-app">

        <cbf:java-class name="WebAppSchema" final="true" equals="true"/>

     </cbf:elementBinding>

     

</cbf:binding>

 

 

Details and environment.

 

Upgraded to castor 1.2 from 0.9.x and we were generating for
web-app_2_3.dtd earlier. Also all dependent required jar files are
upgraded.

As a background,  In our application, web.xml was build dynamically from
different components. For this, the source is generated for the 2_5.xsd
and used (un)marshalling mechanism to build web.xml from different
fragments.  

 

Currently using jdk1.6.0_07 and ant 1.6.5.

 

Any type of suggestion or help will be appreciated.

 

Thank you,

-Sreeni. 

Reply via email to