![]() |
XML document as represented by libxml. More...
#include <LIBXML_DOMDocument.h>
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 |
XML document as represented by libxml.
Definition at line 70 of file LIBXML_DOMDocument.h.
FIX::LIBXML_DOMDocument::LIBXML_DOMDocument | ( | ) | throw ( ConfigError ) |
Definition at line 107 of file LIBXML_DOMDocument.cpp.
00108 : m_pDoc(NULL) 00109 { 00110 }
FIX::LIBXML_DOMDocument::~LIBXML_DOMDocument | ( | ) |
Definition at line 112 of file LIBXML_DOMDocument.cpp.
References m_pDoc.
00113 { 00114 xmlFreeDoc(m_pDoc); 00115 }
DOMNodePtr FIX::LIBXML_DOMDocument::getNode | ( | const std::string & | XPath | ) | [virtual] |
Implements FIX::DOMDocument.
Definition at line 151 of file LIBXML_DOMDocument.cpp.
References m_pDoc, QF_STACK_POP, and QF_STACK_PUSH.
00152 { QF_STACK_PUSH(LIBXML_DOMAttributes::getNode) 00153 00154 xmlXPathContextPtr context = xmlXPathNewContext(m_pDoc); 00155 xmlXPathObjectPtr xpathObject = xmlXPathEval((xmlChar*)XPath.c_str(), context); 00156 00157 if( xpathObject == NULL 00158 || xpathObject->nodesetval == NULL 00159 || xpathObject->nodesetval->nodeNr != 1 ) 00160 { 00161 xmlXPathFreeContext(context); 00162 return DOMNodePtr(); 00163 } 00164 00165 DOMNodePtr result(new LIBXML_DOMNode(xpathObject->nodesetval->nodeTab[0])); 00166 xmlXPathFreeContext(context); 00167 xmlXPathFreeObject(xpathObject); 00168 return result; 00169 00170 QF_STACK_POP 00171 }
bool FIX::LIBXML_DOMDocument::load | ( | const std::string & | url | ) | [virtual] |
Implements FIX::DOMDocument.
Definition at line 132 of file LIBXML_DOMDocument.cpp.
References m_pDoc, QF_STACK_POP, and QF_STACK_PUSH.
00133 { QF_STACK_PUSH(LIBXML_DOMAttributes::lead) 00134 00135 try 00136 { 00137 m_pDoc = xmlParseFile(url.c_str()); 00138 return m_pDoc != NULL; 00139 } 00140 catch( ... ) { return false; } 00141 00142 QF_STACK_POP 00143 }
bool FIX::LIBXML_DOMDocument::load | ( | std::istream & | stream | ) | [virtual] |
Implements FIX::DOMDocument.
Definition at line 117 of file LIBXML_DOMDocument.cpp.
References m_pDoc, QF_STACK_POP, and QF_STACK_PUSH.
00118 { QF_STACK_PUSH(LIBXML_DOMAttributes::load) 00119 00120 try 00121 { 00122 std::stringstream sstream; 00123 sstream << stream.rdbuf(); 00124 m_pDoc = xmlParseDoc((xmlChar*)sstream.str().c_str()); 00125 return m_pDoc != NULL; 00126 } 00127 catch( ... ) { return false; } 00128 00129 QF_STACK_POP 00130 }
bool FIX::LIBXML_DOMDocument::xml | ( | std::ostream & | out | ) | [virtual] |
Implements FIX::DOMDocument.
Definition at line 145 of file LIBXML_DOMDocument.cpp.
References QF_STACK_POP, and QF_STACK_PUSH.
00146 { QF_STACK_PUSH(LIBXML_DOMAttributes::xml) 00147 return false; 00148 QF_STACK_POP 00149 }
xmlDocPtr FIX::LIBXML_DOMDocument::m_pDoc [private] |
Definition at line 83 of file LIBXML_DOMDocument.h.
Referenced by getNode(), load(), and ~LIBXML_DOMDocument().