Harish Aroli wrote:
Hello,
em
I got the problem but not the solution  !!!!!!
Calm down please...


I am storing the XML input from the page to a std::string xml_msg variable.

While parsing I am giving it as parser->parse(xml_msg.c_str());
And that API takes a system ID, so supplying the stream of bytes for an XML document isn't going to work.


parse() will normaly take the full or local path of the xml file or the 
inputsource class.  But here I am passing the XML message itself.
Here the parse() function is taking the full xml message as the path or name of 
xml file which is having the xml message  and is giving issues as there is no 
such file exists.

I don't want to read it from file.  I am already having the xml message ready 
and stored inside a std::string variable.

Is there any way to handle this.
Yes. Instead of using an API incorrectly, take a look at the MemParse sample application.

The extra twist in your use case will be to set the system ID of the InputSource to a fake XML file name with the same directory as the schema file. So, pretend sample.xsd is in /home/user/sample:

MemBufInputSource is(...)

is.setSystemId("/home/user/sample/sample.xml");

Now the parser can resolve the relative reference to sample.xsd using the base URI of the primary document.

Another solution would be to use an EntityResolver, but that's more complicated.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to