472,143 Members | 1,215 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

Determine encoding of XML file with xerces-c and SAXParser

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

Jan 24 '07 #1
2 3401
ch****************@nt.uni-saarland.de wrote:
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
Jan 25 '07 #2
Magnus Henriksson wrote:
ch****************@nt.uni-saarland.de wrote:
>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()
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
Jan 25 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Vince | last post: by
reply views Thread by Francesco Moi | last post: by
8 posts views Thread by davisjoseph | last post: by
10 posts views Thread by Marc Jennings | last post: by
3 posts views Thread by stil | last post: by
24 posts views Thread by Marc Dubois | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.