Problem regarding SAXParser

Discussion in 'C++' started by manish23@gmail.com, Dec 20, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Pete Becker Guest

    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)
     
    Pete Becker, Dec 20, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. stacey
    Replies:
    11
    Views:
    647
    Adam Maass
    Mar 6, 2007
  2. Replies:
    0
    Views:
    463
  3. Andi

    SAXParser xinclude problem

    Andi, Dec 1, 2008, in forum: Java
    Replies:
    6
    Views:
    1,834
  4. Peter Higgins

    libxml's SaxParser and UTF-8 problem

    Peter Higgins, Mar 2, 2007, in forum: Ruby
    Replies:
    2
    Views:
    120
    Jenda Krynicky
    Mar 7, 2007
  5. funkdoobiest

    libxml SaxParser Problem

    funkdoobiest, Dec 19, 2007, in forum: Ruby
    Replies:
    2
    Views:
    147
    funkdoobiest
    Dec 20, 2007
Loading...

Share This Page