Thanks All for your help! As suggested, I followed
the DOMTreeErrorReporter code in the DOMPrint sample,
and it worked!
Thanks again,
Monica
--- Ashay Shende <ashende@xxxxxxxxx> 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:mllau2004@xxxxxxxxx]
> Sent: Tuesday, March 30, 2004 6:49 AM
> To: xerces-c-dev@xxxxxxxxxxxxxx
> 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:
> xerces-c-dev-unsubscribe@xxxxxxxxxxxxxx
> For additional commands, e-mail:
> xerces-c-dev-help@xxxxxxxxxxxxxx
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-c-dev-unsubscribe@xxxxxxxxxxxxxx
> For additional commands, e-mail:
> xerces-c-dev-help@xxxxxxxxxxxxxx
>
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
|