473,394 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 3491
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Vince | last post by:
Hi, Xerces for C++ serializes my DOM in UTF-16. The setEncoding method of my serializer doesn't change anything !! Is it a xerces bug ? Any tip ? Vince
2
by: Jim Cobban | last post by:
I am using Xerces to read an XML file and load it into a DOM so I can update it and subsequently serialize the updated DOM. The problem I have is that as I traverse the DOM I would like to inform...
0
by: Jim Phelps | last post by:
After having memory leak issues with Xerces-c 2.3.0 for Solaris 2.7 for CC 6.2 I have decided to update to at least 2.4. I have downloaded the binary tarball and have installed it on my...
0
by: Francesco Moi | last post by:
Hi. I'm trying to parse a HTTP file http://www.foo.com/foo.xml by using Xerces-Perl: ------------------------------------------ use XML::Xerces; my $file =...
2
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home...
8
by: davisjoseph | last post by:
Hi All, I'm newbie to this XML world. My problem is to identify the encoding type of XML at runtime. What currently I'm doing is checking whether BOM is available in the XML; based on the BOM...
10
by: Marc Jennings | last post by:
Hi there, Can anyone point out any really obvious flaws in the methodology below to determine the likely encoding of a file, please? I know the number of types of encoding is small, but that is...
3
by: ciaran.mchale | last post by:
Hi folks, I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am using it to help me get up to speed with XML and XML Schema. So please excuse me if this is a "novice" question....
3
by: stil | last post by:
hi, i've got a little problem with encoding in UTF_16. i create my document, giving him to my writer to write in a string, when i set an encoding in UTF-8: DOMWriter* L_poWriter =...
24
by: Marc Dubois | last post by:
hi, is it possible to parse an XML file in C so that i can fulfill these requirements : 1) replace all "<" and ">" signs inside the body of tag by a space, e.g. : Example 1: <fooblabla < bla...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.