Hi Peter,
have a look at the function
XMLDecl( const XMLCh* const versionStr
, const XMLCh* const encodingStr
, const XMLCh* const standaloneStr
, const XMLCh* const actualEncodingStr
)
You have to create your own SAXParser class, i.e.:
class mySAXParser : public SAXParser
{
public:
//
-----------------------------------------------------------------------
// Con-/Destructors
//
-----------------------------------------------------------------------
....
//
-----------------------------------------------------------------------
// Implementation of SAXParser Interface
//
-----------------------------------------------------------------------
/**
* This method is used to report the XML decl scanned by the parser.
* Refer to the XML specification to see the meaning of parameters.
*
*
* @param versionStr A const pointer to a Unicode string representing
* version string value.
* @param encodingStr A const pointer to a Unicode string
representing
* the encoding string value.
* @param standaloneStr A const pointer to a Unicode string
* representing the standalone string value.
* @param actualEncodingStr A const pointer to a Unicode string
* representing the actual encoding string
* value.
*/
void XMLDecl
(
const XMLCh* const versionStr
, const XMLCh* const encodingStr
, const XMLCh* const standaloneStr
, const XMLCh* const actualEncodingStr
);
}
XMLDecl will be called from the parser and give information about version,
encoding, etc. to you.
Regards, Christiane
-----Urspr�ngliche Nachricht-----
Von: Peter Michael Bertelsen [mailto:[EMAIL PROTECTED]]
Gesendet am: Mittwoch, 4. Juli 2001 10:41
An: Xerces-C Mailing List (E-mail)
Betreff: Obtaining XML decl from SAX parser?
Hi,
I tried asking this same question (see below) some days ago, but have seen
no responses so far. My apologies if it is a FAQ or just way too obvious.
I've been traversing the Xerces-C API docs to find an answer, but to no
avail.
The point is that I'd like to get my hands on the XML decl (XML version
number and original encoding of the parsed document) when parsing with a SAX
parser. It seems to be possible to get at this information when parsing with
a DOM parser, but I haven't been able to find anything similar in the
Xerces-C SAX/SAX2 APIs. So how do I ask a SAX parser to report the XML decl?
Curiously enough, the following comment appears in the SAX2PrintHandlers
constructor of the SAX2Print sample
(samples/SAX2Print/SAXPrintHandlers.cpp):
// Go ahead and output an XML Decl with our known encoding. This
// is not the best answer, but its the best we can do until we
// have SAX2 support.
Has any functionality for obtaining the XML decl from the parser been
introduced with Xerces' SAX2 API?
Thanks in advance,
Peter Bertelsen
Maconomy A/S (http://www.maconomy.com)
---------------------------------------------------------------------
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]