Ben Griffin wrote:
It appears that the DOMLSInput.setStringData method behaves as if it
has been passed XMLByte*, rather than XMLCh*
The following code fragment succeeds,
std::string grammar = "<schema
xmlns='http://www.w3.org/2001/XMLSchema'
targetNamespace='anyXml'><element name='xml' type='anyType'/ ></schema>";
DOMLSInput* ginput = ((DOMImplementationLS*)impl)->createLSInput();
ginput->setEncoding(XMLUni::fgUTF8EncodingString);
ginput->setStringData((XMLCh*)grammar.c_str()); //nasty!
parser->loadGrammar(ginput, Grammar::SchemaGrammarType, true);
(success)
The following code fragment fails.
XMLCh grammar[] = {'<','s','c','h','e' [[[[ ..same as above but as
XMLCh...]]]] '>',chNull};
DOMLSInput* ginput = ((DOMImplementationLS*)impl)->createLSInput();
ginput->setStringData(grammar);
parser->loadGrammar(ginput, Grammar::SchemaGrammarType, true);
In this case you are forgetting the
ginput->setEncoding(XMLUni::fgXMLChEncodingString) (that is needed if
the XML fragment you are trying to parse is missing the XML header).
Alberto
(fail)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]