Alberto, Thanks. Sorry to disturbed you with wrong XML file. I was having wrong impression that If I use namespace in XML then schemaLocation also in personal NS. *But it's not*.
I have changes to <p:test_in xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="urn:TEMP" xmlns="urn:TEMP" *xsi:schemaLocation*="urn:TEMP test1.xsd"> based on xerces link which you provide to me. It is working fine and I learned that private schema location is not loaded by parser. ( Pasted above if any beginner searches the issue like me would be helpful ) Thanks a lot. -Suresh. On Tue, Sep 27, 2011 at 12:25 PM, Alberto Massari < [email protected]> wrote: > Hi Suresh, > you cannot expect that this XML is going to load an external schema: > > <p:test_in > xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance> > "xmlns:**p="urn:TEMP"xmlns="urn:TEMP"p:**SchemaLocation="urn:TEMP > test_in.xsd"> > > You use a SchemaLocation attribute defined in your personal namespace > "urn:TEMP"; no parser would ever imagine that you want it to treat it as a > reference to a schema to be loaded. > You can find the proper way at http://xerces.apache.org/** > xerces-c/schema-3.html <http://xerces.apache.org/xerces-c/schema-3.html> > (section "Specifying Schema Grammar through attributes in the instance > document") > > Alberto > > Il 27/09/2011 18:06, unique_suresh ha scritto: > >> Hello Alberto, >> >> Thanks for your reply. Its working with third flag enabled. Thanks a lot. >> =) >> >> Now I am trying to load Schema from XML attribute instead of external >> loading. While I am trying to avoid external loading XSD so decided to use >> XMLEntityResolver based on sample from Xerces and internet. When I use >> noNamespece XML with XSD the callback function "resolveEntity" called by >> parser if I use xml with namespece then it is not working. >> >> I think, I was missing some flags to set before parsing xml file OR >> something wrong with my XML/XSD. But I don't have any issue for same xml >> file if load grammar externally with specific file path. ( Which we have >> discussed before) >> >> Overall, the idea is to auto load xsd by parsing attribute info from xml >> and >> call XMLEntityResolver to redirect the path to local file system. But I >> never received call back to "resolveEntity" function. >> >> Please note that, the same code works fine for NoNamespce xml but >> Something >> I am missing here to work for with Name-space. Can you please help. >> >> http://old.nabble.com/file/**p32532099/SchemaValidator1.cpp<http://old.nabble.com/file/p32532099/SchemaValidator1.cpp> >> SchemaValidator1.cpp >> http://old.nabble.com/file/**p32532099/test1.xml<http://old.nabble.com/file/p32532099/test1.xml>test1.xml >> http://old.nabble.com/file/**p32532099/test1.xsd<http://old.nabble.com/file/p32532099/test1.xsd>test1.xsd >> >> >> Thanks in advance. >> >> -Suresh >> >> >> >> Hi Suresh, >> 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 >> >> > -- -Regards, Suresh
