Hi Suresh,
I had already replied you (on the mailing list; are you subscribed?)
Anyhow, this is what I wrote you:
if you want to re-use during the parsing the grammar that you manually
load, you need to add the third argument of loadGrammar, setting it to
true. Otherwise you are parsing the schema, but not caching it for later
use.
Alberto
Il 26/09/2011 22:45, unique_suresh ha scritto:
Guys Please suggest. I am waiting for input you.
Thanks in advance.
-Suresh
unique_suresh wrote:
Hi All,
I am new to Xerces lib and XML approach here. I have created XSD and also
I created test.xml file. Where I want to validate xml with test.xsd file.
Here I want to provide namespace p for all the elements by default and
including attributes. However I have got two sample code from internet I
am trying to run both of them.
Xerces Version used : 3.1.1
OS : Linux
Files : test.xml test.xsd
Code :
load-grammar-dom uses DOMLSParser class to load grammer and validate xml.
SchemaValidator.cpp uses XercesDOMParser class to load grammer and
validate xml.
Here is my problem,
1. Using DOMLSParser validate works fine I dont see any issues with the
code / files
Output:
./load-grammar-dom test.xsd test.xml
loading test.xsd
parsing test.xml
Validation successful !!!
2. Using XercesDOMParser I am getting error message saying " At line 2
Column 89, no declaration found for element 'p:test_in' . I dont
understand that one approach says xml is fine this approach says something
wrong. Please help
Output:
./SchemaValidator test.xsd test.xml
===> At line 2 Column 89, no declaration found for element 'p:test_in'
<====
XML file doesn't conform to the schema
Question :
1. Why DOMLSParser works but XercesDOMParser complaining about element.
2. can you someone explaining to me that difference between DOMLSParser
and XercesDOMParser classes and their pros and cons.
PS : I am very new to xml and xerces lib. Any help would appropriated.
Attachments :
-------------
http://old.nabble.com/file/p32503845/test.xml test.xml
http://old.nabble.com/file/p32503845/test.xsd test.xsd
http://old.nabble.com/file/p32503845/SchemaValidator.cpp
SchemaValidator.cpp
http://old.nabble.com/file/p32503845/load-grammar-dom.cpp
load-grammar-dom.cpp
Thanks
Suresh.