![]() |
00001 /* -*- C++ -*- */ 00002 00003 /**************************************************************************** 00004 ** Copyright (c) quickfixengine.org All rights reserved. 00005 ** 00006 ** This file is part of the QuickFIX FIX Engine 00007 ** 00008 ** This file may be distributed under the terms of the quickfixengine.org 00009 ** license as defined by quickfixengine.org and appearing in the file 00010 ** LICENSE included in the packaging of this file. 00011 ** 00012 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 ** 00015 ** See http://www.quickfixengine.org/LICENSE for licensing information. 00016 ** 00017 ** Contact ask@quickfixengine.org if any conditions of this licensing are 00018 ** not clear to you. 00019 ** 00020 ****************************************************************************/ 00021 00022 #if (HAVE_LIBXML > 0 || _MSC_VER == 0) 00023 #ifndef FIX_LIBXMLDOMDOCUMENT_H 00024 #define FIX_LIBXMLDOMDOCUMENT_H 00025 00026 #ifdef _MSC_VER 00027 #pragma comment( lib, "libxml2" ) 00028 #endif 00029 00030 #include "DOMDocument.h" 00031 #include "Exceptions.h" 00032 #include <libxml/xmlmemory.h> 00033 #include <libxml/parser.h> 00034 00035 namespace FIX 00036 { 00038 class LIBXML_DOMAttributes : public DOMAttributes 00039 { 00040 public: 00041 LIBXML_DOMAttributes( xmlNodePtr pNode ) 00042 : m_pNode(pNode) {} 00043 00044 bool get( const std::string&, std::string& ); 00045 DOMAttributes::map toMap(); 00046 00047 private: 00048 xmlNodePtr m_pNode; 00049 }; 00050 00052 class LIBXML_DOMNode : public DOMNode 00053 { 00054 public: 00055 LIBXML_DOMNode( xmlNodePtr pNode ) 00056 : m_pNode(pNode) {} 00057 ~LIBXML_DOMNode() {} 00058 00059 DOMNodePtr getFirstChildNode(); 00060 DOMNodePtr getNextSiblingNode(); 00061 DOMAttributesPtr getAttributes(); 00062 std::string getName(); 00063 std::string getText(); 00064 00065 private: 00066 xmlNodePtr m_pNode; 00067 }; 00068 00070 class LIBXML_DOMDocument : public DOMDocument 00071 { 00072 public: 00073 LIBXML_DOMDocument() throw( ConfigError ); 00074 ~LIBXML_DOMDocument(); 00075 00076 bool load( std::istream& ); 00077 bool load( const std::string& ); 00078 bool xml( std::ostream& ); 00079 00080 DOMNodePtr getNode( const std::string& ); 00081 00082 private: 00083 xmlDocPtr m_pDoc; 00084 }; 00085 } 00086 00087 #endif 00088 #endif