PUGIXML_DOMDocument.cpp
Go to the documentation of this file.
/****************************************************************************
** Copyright (c) 2001-2014
**
** This file is part of the QuickFIX FIX Engine
**
** This file may be distributed under the terms of the quickfixengine.org
** license as defined by quickfixengine.org and appearing in the file
** LICENSE included in the packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.quickfixengine.org/LICENSE for licensing information.
**
** Contact ask@quickfixengine.org if any conditions of this licensing are
** not clear to you.
**
****************************************************************************/
#ifdef _MSC_VER
#include "stdafx.h"
#else
#include "config.h"
#endif
#include "PUGIXML_DOMDocument.h"
#include <sstream>
namespace FIX
{
bool PUGIXML_DOMAttributes::get( const std::string& name, std::string& value )
{
pugi::xml_attribute result = m_pNode.attribute(name.c_str());
if( !result ) return false;
value = result.value();
return true;
}
DOMAttributes::map PUGIXML_DOMAttributes::toMap()
{
return DOMAttributes::map();
}
DOMNodePtr PUGIXML_DOMNode::getFirstChildNode()
{
pugi::xml_node pNode = m_pNode.first_child();
if( !pNode ) return DOMNodePtr();
return DOMNodePtr(new PUGIXML_DOMNode(pNode));
}
DOMNodePtr PUGIXML_DOMNode::getNextSiblingNode()
{
pugi::xml_node pNode = m_pNode.next_sibling();
if( !pNode ) return DOMNodePtr();
return DOMNodePtr(new PUGIXML_DOMNode(pNode));
}
DOMAttributesPtr PUGIXML_DOMNode::getAttributes()
{
return DOMAttributesPtr(new PUGIXML_DOMAttributes(m_pNode));
}
std::string PUGIXML_DOMNode::getName()
{
return m_pNode.name();
}
std::string PUGIXML_DOMNode::getText()
{
return m_pNode.value();
}
PUGIXML_DOMDocument::PUGIXML_DOMDocument() throw( ConfigError )
{
}
PUGIXML_DOMDocument::~PUGIXML_DOMDocument()
{
//xmlFreeDoc(m_pDoc);
}
bool PUGIXML_DOMDocument::load( std::istream& stream )
{
try
{
return m_pDoc.load(stream);
}
catch( ... ) { return false; }
}
bool PUGIXML_DOMDocument::load( const std::string& url )
{
try
{
return m_pDoc.load_file(url.c_str());
}
catch( ... ) { return false; }
}
bool PUGIXML_DOMDocument::xml( std::ostream& out )
{
return false;
}
DOMNodePtr PUGIXML_DOMDocument::getNode( const std::string& XPath )
{
pugi::xpath_node result = m_pDoc.select_single_node(XPath.c_str());
if( !result ) return DOMNodePtr();
return DOMNodePtr(new PUGIXML_DOMNode(result.node()));
}
}
PUGIXML_DOMDocument.h
FIX::DOMAttributes::map
std::map< std::string, std::string > map
Definition: DOMDocument.h:38
FIX::PUGIXML_DOMAttributes
XML attribute as represented by pugixml.
Definition: PUGIXML_DOMDocument.h:33
FIX::PUGIXML_DOMAttributes::m_pNode
pugi::xml_node m_pNode
Definition: PUGIXML_DOMDocument.h:42
FIX::PUGIXML_DOMAttributes::get
bool get(const std::string &, std::string &)
Definition: PUGIXML_DOMDocument.cpp:31
FIX::PUGIXML_DOMAttributes::toMap
DOMAttributes::map toMap()
Definition: PUGIXML_DOMDocument.cpp:39
FIX::PUGIXML_DOMDocument::xml
bool xml(std::ostream &)
Definition: PUGIXML_DOMDocument.cpp:100
FIX::PUGIXML_DOMDocument::~PUGIXML_DOMDocument
~PUGIXML_DOMDocument()
Definition: PUGIXML_DOMDocument.cpp:77
FIX::PUGIXML_DOMDocument::getNode
DOMNodePtr getNode(const std::string &)
Definition: PUGIXML_DOMDocument.cpp:105
FIX::PUGIXML_DOMDocument::load
bool load(std::istream &)
Definition: PUGIXML_DOMDocument.cpp:82
FIX::PUGIXML_DOMDocument::PUGIXML_DOMDocument
PUGIXML_DOMDocument()
Definition: PUGIXML_DOMDocument.cpp:73
FIX::PUGIXML_DOMDocument::m_pDoc
pugi::xml_document m_pDoc
Definition: PUGIXML_DOMDocument.h:77
FIX::PUGIXML_DOMNode
XML node as represented by pugixml.
Definition: PUGIXML_DOMDocument.h:47
FIX::PUGIXML_DOMNode::getAttributes
DOMAttributesPtr getAttributes()
Definition: PUGIXML_DOMDocument.cpp:58
FIX::PUGIXML_DOMNode::PUGIXML_DOMNode
PUGIXML_DOMNode(pugi::xml_node pNode)
Definition: PUGIXML_DOMDocument.h:49
FIX::PUGIXML_DOMNode::getFirstChildNode
DOMNodePtr getFirstChildNode()
Definition: PUGIXML_DOMDocument.cpp:44
FIX::PUGIXML_DOMNode::m_pNode
pugi::xml_node m_pNode
Definition: PUGIXML_DOMDocument.h:60
FIX::PUGIXML_DOMNode::getName
std::string getName()
Definition: PUGIXML_DOMDocument.cpp:63
FIX::PUGIXML_DOMNode::getText
std::string getText()
Definition: PUGIXML_DOMDocument.cpp:68
FIX::PUGIXML_DOMNode::getNextSiblingNode
DOMNodePtr getNextSiblingNode()
Definition: PUGIXML_DOMDocument.cpp:51
FIX
Definition: Acceptor.cpp:35
FIX::DOMAttributesPtr
SmartPtr< DOMAttributes > DOMAttributesPtr
Definition: DOMDocument.h:45
FIX::DOMNodePtr
SmartPtr< DOMNode > DOMNodePtr
Definition: DOMDocument.h:59
FIX::ConfigError
Application is not configured correctly
Definition: Exceptions.h:88