Determine encoding of XML file with xerces-c and SAXParser

C

christian.eickhoff

Hello Everyone,

I am facing a problem which should be relatively easy to solve for XML
or XERCES experts. I am parsing my XML instance using xerces-c
SAXParser. For internal purposes, it is essential to determine the
charset encoding which is usually indentified within the header of the
XML file e.g. <?xml version="1.0" encoding="UTF-8" ?>
After a query in the xerces-c API documentation I guess that:

- XMLDecl(const XMLCh *const versionStr, const XMLCh *const
encodingStr, const XMLCh *const standaloneStr, const XMLCh *const
actualEncodingStr)

should be the right method to detect the according encoding scheme.
After desperate tries to implement this function, I would like to ask
whether somebody has example code in c++ for me as I am almost about to
faint.. Should be very easy actually but maybe I am just not clever
enough to solve myself.. =((

Every code snippet is highly appreciated!!!!

Thanks in advance,
Chris
 
M

Magnus Henriksson

Hello Everyone,

I am facing a problem which should be relatively easy to solve for XML
or XERCES experts. I am parsing my XML instance using xerces-c
SAXParser. For internal purposes, it is essential to determine the
charset encoding which is usually indentified within the header of the
XML file e.g. <?xml version="1.0" encoding="UTF-8" ?>

getEncoding()




// Magnus
 
M

Magnus Henriksson

Magnus said:
getEncoding()

Sorry, upon further inspection it turns out that this does not work the
same as it does in Java (which I assumed). Can't help you...


// Magnus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top