dcsimg
Problem in validation of XML against an xsd
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   zia_Uddin
Posted On:   Monday, April 30, 2007 05:18 AM

I am stucked in getting my xml validated through an xsd I am getting exception when i am executing my code to validate xml against an xsd Error:----- org.jdom.JDOMException: http://apache.org/xml/properties/schema/external-noNamespaceSchem aLocation property not recognized for SAX driver org.apache.xerces.parsers.SAXParser at org.jdom.input.SAXBuilder.internalSetProperty(SAXBuilder.java:751 ) at org.jdom.input.SAXBuilder.setFeaturesAndProperties(SAXBuilder.jav a:678) at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:528) at org   More>>

I am stucked in getting my xml validated through an xsd
I am getting exception when i am executing my code to validate

xml
against
an xsd


Error:-----


org.jdom.JDOMException:

http://apache.org/xml/properties/schema/external-noNamespaceSchem

aLocation
property not

recognized for SAX driver org.apache.xerces.parsers.SAXParser

at

org.jdom.input.SAXBuilder.internalSetProperty(SAXBuilder.java:751

) at

org.jdom.input.SAXBuilder.setFeaturesAndProperties(SAXBuilder.jav

a:678)
at

org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:528)

at

org.jdom.input.SAXBuilder.build(SAXBuilder.java:424) at

org.jdom.input.SAXBuilder.build(SAXBuilder.java:891) at

XMLValidator.validateSchema(XMLValidator.java:39) at

XMLValidator.main(XMLValidator.java:85)


My Code:-----------


public class XMLValidator {

public void validateSchema(String SchemaUrl, String


XmlDocumentUrl) {

try {
SAXBuilder saxBuilder = new

SAXBuilder("org.apache.xerces.parsers.SAXParser", true);


saxBuilder.setValidation(true);
saxBuilder.setFeature(


"http://apache.org/xml/features/validation/schema", true);
/*error error in this


line*/saxBuilder.setFeature("http://apache.org/xml/features/valid

ation/schema-full-checking"

,true);



saxBuilder.setProperty("http://apache.org/xml/properties/schema/e

xternal-noNamespaceSchemaLo

cation",SchemaUrl); /* error in this line */
................

saxBuilder.build(XmlDocumentUrl);

/*throwing exception here


external-noNamespaceSchemaLocation property not recognized for

SAX
driver

org.apache.xerces.parsers.SAXParser*/





......................



public static void main(String[] argv) {
.............
}

}

-----------------------------------------------------------------

---------------
This is xml format i am creating using jdom parser:-----

<?xml version="1.0" encoding="UTF-8"?>



1237 India STR

ode>
.......



This is xsd:--------------------------------------------

<?xml version="1.0"?>





......................................

Please do reply


Regards


Zia

zia.uddin@yahoo.co.in

   <<Less

Re: Problem in validation of XML against an xsd

Posted By:   Roseanne_Zhang  
Posted On:   Thursday, May 3, 2007 07:15 PM

I answered you at JavaRanch



Put the link here for others to find out.

http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=31&t=006589

About | Sitemap | Contact