PUGIXML_DOMDocument.cpp
Go to the documentation of this file.
00001 /****************************************************************************
00002 ** Copyright (c) 2001-2014
00003 **
00004 ** This file is part of the QuickFIX FIX Engine
00005 **
00006 ** This file may be distributed under the terms of the quickfixengine.org
00007 ** license as defined by quickfixengine.org and appearing in the file
00008 ** LICENSE included in the packaging of this file.
00009 **
00010 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00011 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00012 **
00013 ** See http://www.quickfixengine.org/LICENSE for licensing information.
00014 **
00015 ** Contact ask@quickfixengine.org if any conditions of this licensing are
00016 ** not clear to you.
00017 **
00018 ****************************************************************************/
00019 
00020 #ifdef _MSC_VER
00021 #include "stdafx.h"
00022 #else
00023 #include "config.h"
00024 #endif
00025 
00026 #include "PUGIXML_DOMDocument.h"
00027 #include <sstream>
00028 
00029 namespace FIX
00030 {
00031   bool PUGIXML_DOMAttributes::get( const std::string& name, std::string& value )
00032   {
00033     pugi::xml_attribute result = m_pNode.attribute(name.c_str());
00034     if( !result ) return false;
00035     value = result.value();
00036     return true;
00037   }
00038 
00039   DOMAttributes::map PUGIXML_DOMAttributes::toMap()
00040   {
00041     return DOMAttributes::map();
00042   }
00043 
00044   DOMNodePtr PUGIXML_DOMNode::getFirstChildNode()
00045   {
00046     pugi::xml_node pNode = m_pNode.first_child();
00047     if( !pNode ) return DOMNodePtr();
00048     return DOMNodePtr(new PUGIXML_DOMNode(pNode));
00049   }
00050 
00051   DOMNodePtr PUGIXML_DOMNode::getNextSiblingNode()
00052   {
00053     pugi::xml_node pNode = m_pNode.next_sibling();
00054     if( !pNode ) return DOMNodePtr();
00055     return DOMNodePtr(new PUGIXML_DOMNode(pNode));
00056   }
00057 
00058   DOMAttributesPtr PUGIXML_DOMNode::getAttributes()
00059   {
00060     return DOMAttributesPtr(new PUGIXML_DOMAttributes(m_pNode));
00061   }
00062 
00063   std::string PUGIXML_DOMNode::getName()
00064   {
00065     return m_pNode.name();
00066   }
00067 
00068   std::string PUGIXML_DOMNode::getText()
00069   {
00070     return m_pNode.value();
00071   }
00072 
00073   PUGIXML_DOMDocument::PUGIXML_DOMDocument() throw( ConfigError )
00074   {
00075   }
00076 
00077   PUGIXML_DOMDocument::~PUGIXML_DOMDocument()
00078   {
00079     //xmlFreeDoc(m_pDoc);
00080   }
00081 
00082   bool PUGIXML_DOMDocument::load( std::istream& stream )
00083   {
00084     try
00085     {
00086       return m_pDoc.load(stream);
00087     }
00088     catch( ... ) { return false; }
00089   }
00090 
00091   bool PUGIXML_DOMDocument::load( const std::string& url )
00092   {
00093     try
00094     {
00095       return m_pDoc.load_file(url.c_str());
00096     }
00097     catch( ... ) { return false; }
00098   }
00099 
00100   bool PUGIXML_DOMDocument::xml( std::ostream& out )
00101   {
00102     return false;
00103   }
00104 
00105   DOMNodePtr PUGIXML_DOMDocument::getNode( const std::string& XPath )
00106   {
00107     pugi::xpath_node result = m_pDoc.select_single_node(XPath.c_str());
00108     if( !result ) return DOMNodePtr();
00109 
00110     return DOMNodePtr(new PUGIXML_DOMNode(result.node()));
00111   }
00112 }

Generated on Mon Sep 15 2014 01:23:54 for QuickFIX by doxygen 1.7.6.1 written by Dimitri van Heesch, © 1997-2001