-
Problems on validating XML against Schema using JDOM (1 messages)
- Posted by: Marcio Nielsen Baptista
- Posted on: November 08 2006 12:52 EST
Hi, I am trying to validate a xml against schema. I have successfully validated the xml against the schema in XMLSpy. But when i am trying to validate it in my java code using JDOM, it is giving me the following error: "org.jdom.input.JDOMParseException: Error on line 1: cvc-elt.1: Cannot find the declaration of element 'Mensagem'." I am using the following code: SAXBuilder sb = new SAXBuilder("org.apache.xerces.parsers.SAXParser"); sb.setValidation(true); sb.setFeature("http://apache.org/xml/features/validation/schema", true); sb.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation", "http://localhost:8988/gofer/gofer.xsd"); this.setDocumentoXML( sb.build( new StringReader(valorParam) ) ); gofer.xsd (Root Element): ================= xml String (Root Element) ================= <?xml version="1.0" encoding="ISO-8859-1" ?> I am wondering if I am doing anything wrong. Thanks Marcio Nielsen Baptista.Threaded Messages (1)
- Re: Problems on validating XML against Schema using JDOM by Rakesh Malpani on November 15 2006 12:16 EST
-
Re: Problems on validating XML against Schema using JDOM[ Go to top ]
- Posted by: Rakesh Malpani
- Posted on: November 15 2006 12:16 EST
- in response to Marcio Nielsen Baptista
xml String (Root Element)
I don't see the element ending (like /> or .. is that the problem by any chance? Rakesh.
=================
<?xml version="1.0" encoding="ISO-8859-1" ?>
identificador="L00196b6272223b453ed9844a8815ac7f2f9">
I am wondering if I am doing anything wrong.
Thanks
Marcio Nielsen Baptista.