Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation of XML against schema using JDOM

Status
Not open for further replies.

dparikh72

Programmer
Oct 14, 2005
5
US
I am trying to validate my xml using JDOM way of validating against schema but all the time i get same error:

I get SAXParse Exception and when i check the cause i get this:

"cvc-elt.1: Cannot find the declaration of element 'document'".

I take the XML and if i validate it using XML SPY it is a Valid XML.

I am confused, why am i not able to validate by the code ?

My code is as follows:

SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
builder.setFeature(" true);
builder.setProperty(" xsdPath);

Document doc = builder.build(xmlFile);

Is that something wrong i am trying ?

waiting

thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top