Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to validate xml using xsd?

XML XSD
0
Posted

How to validate xml using xsd?

0

Hi i am using the code below to validate an xml using an xsd. The corresponding xml and xsd have been attached. Despit the xml being valid according to my editor, which validates against the xsd, i keep getting this error with jdom: org.jdom.input.JDOMParseException: Error on line 3: cvc-elt.1: Cannot find the declaration of element ’email’. As far as i know, my xsd is valid as well as the xml. Is there something more i need to do in my code to have validation successfull? code: public void testXmlFormat() { SAXBuilder builder = new SAXBuilder(true); builder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { //code to return the resource corresponding to http://truc.much.com/email.xsd and printing on stderr the full url to resource //return null for other systemId; } }); try { builder.setProperty( JAXPConstants.JAXP_SCHEMA_LANGUAGE, JAXPConstants.W3C_XML_SCHEMA ); InputStream source = getClass()

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.