Thanks All for your help!  As suggested, I followed
the DOMTreeErrorReporter code in the DOMPrint sample,
and it worked!

Thanks again,
Monica  


--- Ashay Shende <[EMAIL PROTECTED]> wrote:
> Hi, If you are using XercesDOMParser, I think you
> will have to inherit from
> ErrorHandler class.
> You can then implement the fatalError() method and
> display the line number
> etc where the error occured.
> 
> Hope this helps.
> 
> -----Original Message-----
> From: Monica Lau [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 30, 2004 6:49 AM
> To: [EMAIL PROTECTED]
> Subject: No Parsing Errors?!
> 
> 
> Hi all,
> 
> I am very new to XML as well as to the Xerces XML
> parser.  I have a very simple program below to parse
> the XML string: "<hello>abc</world>"  When I run
> this
> program, the program runs smoothly, and I don't get
> any error messages at all.  I'm not sure what I'm
> doing wrong...  Please help -- thanks for your time!
> 
> Regards,
> Monica
> 
> 
> #include <iostream.h>
> #include <xercesc/parsers/XercesDOMParser.hpp>
> #include <xercesc/dom/DOM.hpp>
> #include <xercesc/util/XMLString.hpp>
> #include <xercesc/util/PlatformUtils.hpp>
> #include <xercesc/util/XercesDefs.hpp>
> #include <xercesc/util/ParseException.hpp>
> #include <xercesc/dom/DOMDocument.hpp>
> #include <xercesc/framework/MemBufInputSource.hpp>
> 
> int main()
> {
>    try
>    {
>       XMLPlatformUtils::Initialize();
>    }
>    catch (const XMLException &error)
>    {
>       char *msg =
> XMLString::transcode(error.getMessage());
>       cout << "Error during initialization: " << msg
> << endl;
>       return -1;
>    }
> 
>    XercesDOMParser parser;
>    parser.setDoSchema(false);
> 
>
parser.setValidationScheme(XercesDOMParser::Val_Never);
> 
>    // Parse XML file.
>    char *myXMLStr = "<hello>abc</world>";
> 
>    try
>    {
>       MemBufInputSource mbis( (const XMLByte
> *)myXMLStr, strlen(myXMLStr), "dummy", false);
>       parser.parse(mbis);
>    }
>    catch(const XMLException &error)
>    {
>       char *msg =
> XMLString::transcode(error.getMessage());
>       cout << "Error during parsing: " << msg <<
> endl;
>       return -1;
>    }
>    catch (const DOMException &error)
>    {
>       char *msg = XMLString::transcode(error.msg);
>       cout << "Error during parsing: " << msg <<
> endl;
>       return -1;
>    }
>    catch(...)
>    {
>       cout << "Unexpected exception during parsing."
> << endl;
>       return -1;
>    }
> 
>    return 0;
> }
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on
> time.
> http://taxes.yahoo.com/filing.html
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to