Hi the problem here is input doesnot get uniq SystemId,PublicIdand BaseURI.
so add this lines to get the functionality same as file loading.
input->setBaseURI(getIDStr());
input->setSystemId(getIDStr());
input->setPublicId(getIDStr());
But why are these values not set automaticaly for string but set for
filename as parameter to loadgrammer???
vivekanand wrote:
>
> Hi all,
> I have been facing this problem with loadGrammar when i am loading two
> grammer(XSD) files using DOMLSInput; The second file is not geting loaded.
> but It is working fine if loadGramer is called with file names.
> here are the xmlfiles:
> http://old.nabble.com/file/p28520601/ipo.xsd ipo.xsd
> http://old.nabble.com/file/p28520601/address.xsd address.xsd
>
> code for load using DOMLSInput:
>
> DOMLSInput* input = ((DOMImplementationLS*)impl)->createLSInput();
> XMLCh* str = XMLString::transcode(xsdStr1.c_str());
> input->setStringData(str);
> input->setEncoding(XMLUni::fgXMLChEncodingString);
> if (!parser->loadGrammar (input, Grammar::SchemaGrammarType,
> true))
> {
> cerr << ": error: unable to load" << endl;
> }
> XMLString::release(&str);
> str = XMLString::transcode(xsdStr2.c_str());
> input->setStringData(str);
> input->setEncoding(XMLUni::fgXMLChEncodingString);
> if (!parser->loadGrammar (input, Grammar::SchemaGrammarType,
> true))
> {
> cerr << ": error: unable to load" << endl;
> }
> BinOutputStream* outStream = new
> BinFileOutputStream("outfile_inmemory.binary");
> gp->serializeGrammars(outStream);
>
> code for load using filenames:
> cout<<"parser configured and redy"<<endl;
> if (!parser->loadGrammar (xsdStrfilename1.c_str(),
> Grammar::SchemaGrammarType, true))
> {
> cerr << ": error: unable to load" << endl;
> }
> if (!parser->loadGrammar (xsdStrfilename2.c_str(),
> Grammar::SchemaGrammarType, true))
> {
> cerr << ": error: unable to load" << endl;
> }
> BinOutputStream* outStream = new
> BinFileOutputStream("outfile_inFile.binary");
> gp->serializeGrammars(outStream);
>
> outfile_inFile.binary outfile_inmemory.binary files are different
>
> i am un able to validate XML proparly becaus of it??
> why is that happening??? am i doing something wrong or is there other
> method to load XSD string for validation??
>
--
View this message in context:
http://old.nabble.com/DOM-loadgrammar%28%29-bahaves-different-with-DOMLSInput.-tp28520601p28654479.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.