Hi,

I have the following problem: I have a DTD in a MemoryBuffer that the parser
(SAX) should use when it is parsing many xml files. The first problem is
that the parser doesn't remember the DTD (perhaps loadGrammar does not work
correctly?), so I use an entity resolver to return my membuffer-DTD instead of
the one pointed to in the document type declaration. But then I get the
following error during runtime: "Error at line 1, character 3: Expected a markup
declaration". This error is independend from the parsed xml file.

Does anybody know how to solve this problem? What does it mean anyway?

Thanks,

Heiko

****************************************
Code:

SAXParser* parser = new SAXParser;
    
parser->setDoNamespaces(false);
parser->cacheGrammarFromParse(true);

MemBufInputSource* abcdtd = new MemBufInputSource
 (
    (const XMLByte*)_r2r_abcdtd, strlen(_r2r_abcdtd), "abc", false
);
                
parser->loadGrammar(*abcdtd, Grammar::DTDGrammarType, true);
                                                
parser->setDocumentHandler(hnd_p);
parser->setErrorHandler(hnd_p);
parser->setEntityResolver(hnd_p); // returns abcdtd

StreamInputSource streamReader(&in);

parser->parse(streamReader);

*********************************************
Beginning of xml:

1: <?xml version='1.0' encoding='iso-8859-1'?>
2: 
3: <!DOCTYPE REXRULE PUBLIC "abc.dtd">
4:
5: <abc>
6:

[...]



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

Reply via email to