Hi David,

I've actually ran into the same problem some time ago. The simple, but
maybe disappointing answer is: JiBX does not support
annotation/documentation for an xml schema import tag.

So the only solution I could come up with is remove the annotation and
directly close the import tag. You might have to do it at several places if
the XML schema is rich in annotations.

The good new is that the meaning of the XML schema will not be changed by
removing annotations, so you should still be able to continue with your
original goal.

If you're keen on automating the process of removing the annotations, to
support future or other versions of the schema, you can do a pre-processing
of the xsd with a DOM or SAX parser and strip out all annotation elements.


Good luck & kind regards,


Erik



On Sat, Nov 10, 2012 at 5:44 PM, Chun Tat David Chu <
beyonddc.stor...@gmail.com> wrote:

> Hi All,
>
> I am a first timer on JIBX.
>
> I am trying to run CodeGen on a XML schema and I am hitting a problem that
> I am not sure how to resolve.  Below is the exception from CodeGen.
>
> Exception in thread "main" org.jibx.runtime.JiBXException: Expected "{
> http://www.w3.org/2001/XMLSchema}import"; end tag, found "{
> http://www.w3.org/2001/XMLSchema}annotation"; start tag (line 44, col 25,
> in xccdf-1.1.4.xsd)
>     at
> org.jibx.runtime.impl.UnmarshallingContext.parsePastCurrentEndTag(UnmarshallingContext.java:731)
>     at
> org.jibx.schema.elements.JiBX_schema_xsprefix_bindingImportElement_access.unmarshal()
>     at
> org.jibx.schema.elements.FilteredSegmentList.JiBX_schema_noprefix_binding_unmarshal_3_0(FilteredSegmentList.java)
>     at
> org.jibx.schema.elements.SchemaElement.JiBX_schema_noprefix_binding_unmarshal_3_0(SchemaElement.java)
>     at
> org.jibx.schema.elements.JiBX_schema_xsprefix_bindingSchemaElement_access.unmarshal()
>     at org.jibx.schema.elements.SchemaElement.unmarshal(SchemaElement.java)
>     at
> org.jibx.schema.validation.ValidationUtils.load(ValidationUtils.java:130)
>     at org.jibx.schema.codegen.CodeGen.generate(CodeGen.java:1710)
>     at org.jibx.schema.codegen.CodeGen.main(CodeGen.java:2206)
>
> An here's the section where CodeGen is having an hiccup.  <xsd:annotation>
> is line 44.
>     <xsd:import namespace="http://www.w3.org/XML/1998/namespace";
>        schemaLocation="xml.xsd">
>         <xsd:annotation>
>             <xsd:documentation xml:lang="en">
>                 Import the XML namespace because this schema uses
>                 the xml:lang and xml:base attributes.
>             </xsd:documentation>
>         </xsd:annotation>
>
> Here's the command line argument I use to run CodeGen.
> java -cp ${JIBX_HOME}/lib/jibx-tools.jar org.jibx.schema.codegen.CodeGen
> -t ./bindings -v -w xccdf-1.1.4.xsd
>
> I am not sure where to begin to debug this issue, all the supporting XML
> schema is also in the same directory.  I didn't define the schema, I
> obtained the schema from a government website.  I am trying to write a JAVA
> application that would parse XML files that comply to the XCCDF schema.
> Instead of attaching the schema with this email, I am going to attach the
> link to download it in case anyone would like to give it a quick try.
> http://nvd.nist.gov/scap/xccdf/docs/xccdf-1.1.4-schema-bundle-20071011.zip
>
> Thanks in advance!
>
> David
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_nov
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>


-- 
*Erik Mulder*
Principal Consultant

*m*: +31 6 40 76 45 22
*@*: erik.mul...@qsd.nl


*
QSD B.V.
*Loolaan 89
3971 PM Driebergen-Rijsenburg
t: +31 343 76 41 50
*w*: http://www.qsd.nl/
*@*: i...@qsd.nl

Dit bericht is vertrouwelijk en kan geheime informatie bevatten enkel
bestemd voor de geadresseerde. Indien dit bericht niet voor u is bestemd,
verzoeken wij u dit onmiddellijk aan ons te melden en het bericht te
vernietigen. Aangezien de integriteit van het bericht niet veilig gesteld
is middels verzending via internet, kan QSD niet aansprakelijk worden
gehouden voor de inhoud daarvan. Hoewel wij ons inspannen een virusvrij
netwerk te hanteren, geven wij geen enkele garantie dat dit bericht
virusvrij is, noch aanvaarden wij enige aansprakelijkheid voor de mogelijke
aanwezigheid van een virus in dit bericht. Op al onze rechtsverhoudingen,
aanbiedingen en overeenkomsten waaronder QSD goederen en/of diensten levert
zijn met uitsluiting van alle andere voorwaarden de Leveringsvoorwaarden
van QSD van toepassing. Deze worden u op aanvraag direct kosteloos
toegezonden.

This e-mail and the documents attached are confidential and intended solely
for the addressee; it may also be privileged. If you receive this e-mail in
error, please notify the sender immediately and destroy it. As its
integrity cannot be secured on the Internet, the QSD liability cannot be
triggered for the message content. Although the sender endeavours to
maintain a computer virus-free network, the sender does not warrant that
this transmission is virus-free and will not be liable for any damages
resulting from any virus transmitted. On all offers and agreements under
which QSD supplies goods and/or services of whatever nature, the Terms of
Delivery from QSD exclusively apply. The Terms of Delivery shall be
promptly submitted to you on your request.

QSD B.V.
KvK Utrecht 53067231

<<QSD-icon-gradient.png>>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to