By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,133 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,133 IT Pros & Developers. It's quick & easy.

Problem regarding SAXParser

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.