Public Member Functions | Private Attributes
FIX::LIBXML_DOMDocument Class Reference

XML document as represented by libxml. More...

#include <LIBXML_DOMDocument.h>

Inheritance diagram for FIX::LIBXML_DOMDocument:
Inheritance graph
[legend]
Collaboration diagram for FIX::LIBXML_DOMDocument:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LIBXML_DOMDocument () throw ( ConfigError )
 ~LIBXML_DOMDocument ()
bool load (std::istream &)
bool load (const std::string &)
bool xml (std::ostream &)
DOMNodePtr getNode (const std::string &)

Private Attributes

xmlDocPtr m_pDoc

Detailed Description

XML document as represented by libxml.

Definition at line 70 of file LIBXML_DOMDocument.h.


Constructor & Destructor Documentation

Definition at line 89 of file LIBXML_DOMDocument.cpp.

  : m_pDoc(NULL)
  {
  }

Definition at line 94 of file LIBXML_DOMDocument.cpp.

References m_pDoc.

  {
    xmlFreeDoc(m_pDoc);
  }

Member Function Documentation

DOMNodePtr FIX::LIBXML_DOMDocument::getNode ( const std::string &  XPath) [virtual]

Implements FIX::DOMDocument.

Definition at line 126 of file LIBXML_DOMDocument.cpp.

References m_pDoc.

  {
    xmlXPathContextPtr context = xmlXPathNewContext(m_pDoc);
    xmlXPathObjectPtr xpathObject = xmlXPathEval((xmlChar*)XPath.c_str(), context);

    if( xpathObject == NULL
        || xpathObject->nodesetval == NULL
        || xpathObject->nodesetval->nodeNr != 1 )
    {
      xmlXPathFreeContext(context);
      return DOMNodePtr();
    }

    DOMNodePtr result(new LIBXML_DOMNode(xpathObject->nodesetval->nodeTab[0]));
    xmlXPathFreeContext(context);
    xmlXPathFreeObject(xpathObject);
    return result;
  }
bool FIX::LIBXML_DOMDocument::load ( std::istream &  stream) [virtual]

Implements FIX::DOMDocument.

Definition at line 99 of file LIBXML_DOMDocument.cpp.

References m_pDoc.

  {
    try
    {
      std::stringstream sstream;
      sstream << stream.rdbuf();
      m_pDoc = xmlParseDoc((xmlChar*)sstream.str().c_str());
      return m_pDoc != NULL;
    }
    catch( ... ) { return false; }
  }
bool FIX::LIBXML_DOMDocument::load ( const std::string &  url) [virtual]

Implements FIX::DOMDocument.

Definition at line 111 of file LIBXML_DOMDocument.cpp.

References m_pDoc.

  {
    try
    {
      m_pDoc = xmlParseFile(url.c_str());
      return m_pDoc != NULL;
    }
    catch( ... ) { return false; }
  }
bool FIX::LIBXML_DOMDocument::xml ( std::ostream &  out) [virtual]

Implements FIX::DOMDocument.

Definition at line 121 of file LIBXML_DOMDocument.cpp.

  {
    return false;
  }

Member Data Documentation

xmlDocPtr FIX::LIBXML_DOMDocument::m_pDoc [private]

Definition at line 83 of file LIBXML_DOMDocument.h.

Referenced by getNode(), load(), and ~LIBXML_DOMDocument().


The documentation for this class was generated from the following files:

Generated on Mon Jun 23 2014 23:49:39 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001