validating XML with a schema using SAX
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aarun_Jones
Posted On:   Saturday, November 5, 2005 05:57 AM

Hi All,
I've created a text.xsd and a test_sample.xml. I've used XML spy to make sure that they are valid.

now I want to parse XML with validation in Java.


I've done factroy.setvalidating(true); and
factroy.setNamespaceAware(true); But, when I parse the XML, I get the error as follows:

The prefix "myReqnamespace" for element "myReqnamespace:myReq" is not bound.

Also, in case of SAX how do I specify the schema file name?


I appreciate your help.


Thanks,

Aarun

Re: validating XML with a schema using SAX

Posted By:   Aarun_Jones  
Posted On:   Sunday, November 6, 2005 12:23 AM

I've declared the namespace declaration, but still I get the same error.


I am using xerces SAX parser and I've set the required properties(schemalocation and noNameSpaceSchemaLocation) and feature (validation/dynamic) set.


the error FatalError :1:193: The prefix "n" for element "n:myReq" is not bound.



I believe it is not finding my xsd file. How do I specify that in the properties and where in the directory structure should I keep the actual myReq.xsd file?


I really appreciate your help!

thanks,

Aarun

About | Sitemap | Contact