473,405 Members | 2,185 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,405 software developers and data experts.

Problem regarding SAXParser

Hi

I am trying to parse an xml document with the following header
<?xml version="1.0" encoding="utf-8"?>

I am using SAXParser to parse th file as shown in code below:

SAXParser sax;

MemBufInputSource buf((const XMLByte*) text.chars( CHARSET_UTF_8
),text.b_length( CHARSET_UTF_8 ), buffer_name); //text contains actual
xml file to be parsed
try
{
sax.parse(buf); //fail here
}
catch (const SAXException& e)
{
fprintf(stderr,"Exception thrown: %s", e.what());
}
catch (std::exception &e)
{
fprintf(stderr,"Exception thrown: %s", e.what());

// Close everything down here and present an error message
}
catch (...)
{
fprintf(stderr,"INSIDE ELIPSES");
}

The problem is that the code is failing at sax.parse method. And also
there is no exception being thrown because of which i am unable to
figure out why the parse method is failing.
So is this because there is some problem with the encoding scheme of
the document or something else? And why is it not throwing any
exceptions?

Kindly provide any suggession in this regard

Thanks

Dec 20 '06 #1
1 1686
ma******@gmail.com wrote:
>
I am using SAXParser to parse th file as shown in code below:
SAXParser isn't part of the C++ standard library. You should ask whoever
you got it from.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Dec 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jonathan | last post by:
I have written a SAX parser to read a simple XML file using this code : SAXParserFactory factory = SAXParserFactory.newInstance(); javax.xml.parsers.SAXParser saxParser =...
2
by: Frederik Himpe | last post by:
I'm implementing a SAX handler with libxml++. I have this piece of code: void PalamedeParser::on_start_element(const std::string &name, const AttributeList &attributes) { AttributeList::iterator...
7
by: Kirt | last post by:
i have walked a directory and have written the foll xml document. one of the folder had "&" character so i replaced it by "&amp;" #------------------test1.xml <Directory> <dirname>C:\Documents and...
0
by: manish23 | last post by:
Hi I am trying to parse an xml document with the following header <?xml version="1.0" encoding="utf-8"?> I am using SAXParser to parse th file as shown in code below: SAXParser sax; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.