Hi all,
I'm a newbie here so probably this one won't be too difficult for you...
I'm trying to make my DOM parser parse a buffer containing an XML
document (and not parse a file as in samples). I've seen that work with
SAX, but with DOM, I get an 'Aborted' !
% ./domparsetest
Initialize the platform
Instantiate the DOM Parser
Create Error Handler
Create XML document to parse
<?xml version='1.0' encoding='ascii'?>
<UpdatePolicy>
<PolicyFile> /etc/toto.txt <PolicyFile>
</UpdatePolicy>
init membufIS
Parse
Aborted
%
---
Basically, I just build a XercesDOMParser, set the error handler, make a
MemBufInputSource out of my XML buffer, and parse it:
try
{
XMLPlatformUtils::Initialize();
}
catch(const XMLException& toCatch)
{
...
}
XercesDOMParser *m_Parser = new XercesDOMParser;
m_Parser->setValidationScheme(XercesDOMParser::Val_Auto);
m_Parser->setDoNamespaces(false);
m_Parser->setDoSchema(true);
m_Parser->setValidationSchemaFullChecking(false);
ErrorHandler *m_ErrorHandler = (ErrorHandler *) new HandlerBase();
m_Parser->setErrorHandler(m_ErrorHandler);
const char *buffer = "<?xml version='1.0' encoding='" "ascii" "'?>\n\
<UpdatePolicy>\n\
<PolicyFile> /etc/toto.txt <PolicyFile>\n\
</UpdatePolicy>\n";
MemBufInputSource* memBufIS = new MemBufInputSource((const XMLByte*)
buffer,
strlen(buffer),
bufId);
try
{
m_Parser->parse(*memBufIS); <------ I get an 'Aborted' from here !
}
catch (const XMLException& toCatch)
{
...
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- Re: DOMParser on a buffer, not a file Axelle Apvrille (LMC)
- Re: DOMParser on a buffer, not a file Gareth Reakes
- Re: DOMParser on a buffer, not a file Axelle Apvrille (LMC)
