Validating an XML against an XSD - root element not found

A

Andrew Thompson

AAArrrghh! I have been trying to validate XML
files against XSD files when both are on the
local file system, on and off for the last month.

It is 'almost' working, except that the validator
always reports that the *root* element of the XML
file is missing (for a JNLP file, that would be
the jnlp element). Frustratingly, apart from that,
it seems to work as I expect.

Here is a zip of the current files (a build file,
the Java source, and some XML and XSD files).
<http://www.physci.org/test/xml/xmlvalidate.zip>
(under 30 Kb). If you run the build.xml 'launch'
task, it should compile (build etc.) and throw the
GUI onto screen.

The problem can be seen by openning (for example)
yaxv.jnlp (which has an intentionally invalid
attribute - 'tootip') into the left hand side of
the GUI, then loading the JNLP-6.0.xsd into the
RHS of the GUI and clicking the Validate button
(lower left of GUI, above the list).

This will produce an error list of three items.
The second and third relate to the 'tootip', but
I cannot figure why I am getting the first error...
"cvc-elt. 1: Cannot find the delcaration of element 'jnlp'."

If I validate the documents using the ant
xmlvalidate task, it does not show that
first error. That suggests it is not a
problem with the XSD file (which I developed
based on an initial DTD->XSD conversion by
Piotr Kobzda), but the GUI code I am using.

Can anybody spot the problem that is causing
the first error, and advise how I can 'suppress
it'?

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200709/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top