For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > December 2006 > Problem regarding SAXParser









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem regarding SAXParser
manish23@gmail.com

2006-12-20, 8:08 am

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

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com