Independent of the API you want to use, DOM, SAX, or SAX2, your application must initialize the Xerces system before using the API, and terminate it after you are done. This is achieved by the following code:
    #include <xercesc/util/PlatformUtils.hpp>
    // Other include files, declarations, and non-Xerces-C++ initializations.
    XERCES_CPP_NAMESPACE_USE

    int main(int argc, char* argv[])
    {
      try {
        XMLPlatformUtils::Initialize();
      }
      catch (const XMLException& toCatch) {
        // Do your failure processing here
        return 1;
      }

      // Do your actual work with Xerces-C++ here.

      XMLPlatformUtils::Terminate();

      // Other terminations and cleanup.
      return 0;
    }
`XMLPlatformUtils::Initialize()` and `XMLPlatformUtils::Terminate` must be called at least once in each process. You are allowed to call `XMLPlatformUtils::Initialize()` and `XMLPlatformUtils::Terminate` multiple times, but each call to `XMLPlatformUtils::Initialize()` must be matched with a call to `XMLPlatformUtils::Terminate`.
| DOM Programming Guide |
| The DOM API is based on the Apache Recommended DOM C++ binding. Read the DOM Programming Guide document or jump directly to: Design Objectives DOM Level 3 Support in Xerces-C++ Using DOM API Accessing API from application code Class Names Objects Management Memory Management String Type XercesDOMParser Constructing a XercesDOMParser Supported Features Supported Properties DOMBuilder Constructing a DOMBuilder How to interchange DOMInputSource and SAX InputSource? Supported Features Supported Properties DOMWriter Constructing a DOMWriter How does DOMWriter handle built-in entity Reference in node value? Supported Features Deprecated - Java-like DOM
| SAX Programming Guide |
| Read the SAX Programming Guide document or jump directly to: Using the SAX API SAXParser Constructing a SAXParser Supported Features
| SAX2 Programming Guide |
| Read the SAX2 Programming Guide document or jump directly to: Using the SAX2 API SAX2XMLReader Constructing an XML Reader Supported Features Supported Properties
| Other Features |
| Read the Xerces-C++ Programming Guide document or jump directly to: Version Macros Schema Support Progressive Parsing Preparsing Grammar and Grammar Caching Loadable Message Text Pluggable Transcoders Porting Guidelines Using C++ Namespace Specify Locale for Message Loader Specify Location for Message Loader Use Specific Scanner Pluggable Panic Handler Pluggable Memory Manager Managing Security Vulnerabilities

Copyright © 1999-2005 The Apache Software Foundation. All Rights Reserved.