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]

Reply via email to