PUGIXML_DOMDocument.cpp
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (c) 2001-2014
3**
4** This file is part of the QuickFIX FIX Engine
5**
6** This file may be distributed under the terms of the quickfixengine.org
7** license as defined by quickfixengine.org and appearing in the file
8** LICENSE included in the packaging of this file.
9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12**
13** See http://www.quickfixengine.org/LICENSE for licensing information.
14**
15** Contact ask@quickfixengine.org if any conditions of this licensing are
16** not clear to you.
17**
18****************************************************************************/
19
20#ifdef _MSC_VER
21#include "stdafx.h"
22#else
23#include "config.h"
24#endif
25
26#include "PUGIXML_DOMDocument.h"
27#include <sstream>
28
29namespace FIX
30{
31 bool PUGIXML_DOMAttributes::get( const std::string& name, std::string& value )
32 {
33 pugi::xml_attribute result = m_pNode.attribute(name.c_str());
34 if( !result ) return false;
35 value = result.value();
36 return true;
37 }
38
43
45 {
46 pugi::xml_node pNode = m_pNode.first_child();
47 if( !pNode ) return DOMNodePtr();
48 return DOMNodePtr(new PUGIXML_DOMNode(pNode));
49 }
50
52 {
53 pugi::xml_node pNode = m_pNode.next_sibling();
54 if( !pNode ) return DOMNodePtr();
55 return DOMNodePtr(new PUGIXML_DOMNode(pNode));
56 }
57
62
64 {
65 return m_pNode.name();
66 }
67
69 {
70 return m_pNode.value();
71 }
72
76
78 {
79 //xmlFreeDoc(m_pDoc);
80 }
81
82 bool PUGIXML_DOMDocument::load( std::istream& stream )
83 {
84 try
85 {
86 return m_pDoc.load(stream);
87 }
88 catch( ... ) { return false; }
89 }
90
91 bool PUGIXML_DOMDocument::load( const std::string& url )
92 {
93 try
94 {
95 return m_pDoc.load_file(url.c_str());
96 }
97 catch( ... ) { return false; }
98 }
99
100 bool PUGIXML_DOMDocument::xml( std::ostream& out )
101 {
102 return false;
103 }
104
105 DOMNodePtr PUGIXML_DOMDocument::getNode( const std::string& XPath )
106 {
107 pugi::xpath_node result = m_pDoc.select_single_node(XPath.c_str());
108 if( !result ) return DOMNodePtr();
109
110 return DOMNodePtr(new PUGIXML_DOMNode(result.node()));
111 }
112}
std::map< std::string, std::string > map
Definition DOMDocument.h:38
XML attribute as represented by pugixml.
bool get(const std::string &, std::string &)
DOMNodePtr getNode(const std::string &)
XML node as represented by pugixml.
DOMAttributesPtr getAttributes()
SmartPtr< DOMAttributes > DOMAttributesPtr
Definition DOMDocument.h:45
SmartPtr< DOMNode > DOMNodePtr
Definition DOMDocument.h:59
Application is not configured correctly
Definition Exceptions.h:88

Generated on Mon Mar 4 2024 21:10:02 for QuickFIX by doxygen 1.9.8 written by Dimitri van Heesch, © 1997-2001