Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problems with parsing XMLSchema with JAXB

  Asked By: Boell    Date: Mar 30    Category: Java    Views: 2006

I have an XMLSchema file and need to compile it with
JAXB (XJC) in order to extract the relevant classes
and then validate XML documents according to the
schema. But the schema can't be compiled. I am
recieving series of errors like this:

[ERROR] s4s-elt-character: Non-whitespace characters
are not allowed in schema elements other than
'xs:appinfo' and 'xs:documentation'. Saw
'BitsPerPixel'. line 142 of ccppschema-20030226.xsd

The XMLSchema is located in the following address:

The versions I am usnig is JWSDP 1.4 on Redhat 9. (I
wanted to download the latest version, i.e. JWSDP 1.6
, but couldn't do that due to server authorization



3 Answers Found

Answer #1    Answered By: Hadil Khan     Answered On: Mar 30

I read ccppschema-20030226.xsd and the error.
I guess you have an illegal character in that schema,
and i think it is Double Quote (").
Read the error  message again:

** ERROR: Non-whitespace characters are not allowed  in schema
elements **

You don't receive error before BitsPerPixel entity,
i see them free of Double Quote in their comments.
and I guess the same error occurred for "CPU", "ColorCapable"
"InputCharSet" and other entities that their comment includes
Double Quote.

Answer #2    Answered By: Dale Jones     Answered On: Mar 30

I hadn't paied
attention to that! ;) But unfortunately that's not the
problem. I must add that the error  line which I had
included in the previous email, is not the first error
returned. I receive errors  from the beggining of the
parsing process. The first error is:

[ERROR] s4s-elt-character: Non-whitespace characters
are not allowed  in schema  elements other than
'xs:appinfo' and 'xs:documentation'. Saw 'A Component
within the CC/PP Schema is a class of related
properties '.
line 23 of ccppschema-20030226

which is about the first element declared in the
schema. I tried removing all of the comments and their
tags, but now I receive the same error on the line
after (i.e. where the 'label' is defined).

If you had compiled  the schema yourself and you have
received the first error on BitsPerPixel, plz let me
know which version you are using.

Now, plz tell me what to do! :(
As before, any comments would be appreciated. :)

Answer #3    Answered By: Nicolas Costa     Answered On: Mar 30

That document is a RDF and not an not a xml-schema to parse it with jaxb
directly. To keep it simple you can say it is one abstraction level
higher than the xml  schema. You can imagine, the file  is an instance (a
xml file) based on the xml-schema for RDF - which is referenced in the
file and relies on w3c website.
To read more about it you might go to http://www.w3.org/TR/rdf-concepts/
. What you can reach with jaxb  is trying to generate the classes for RDF
(based on the rdf schema) which is not your intention I think.

To process and handle the corresponding java objects you might received
or create- which I think is what you should be looking for- you can
consider using projects like JRDF ( http://jrdf.sourceforge.net/ ) or
4Suite (http://4suite.org/index.xhtml).

Hope these lines helps to sort out some confusions

Didn't find what you were looking for? Find more on problems with parsing XMLSchema with JAXB Or get search suggestion and latest updates.