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 
29 namespace 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 
40  {
41  return DOMAttributes::map();
42  }
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 
59  {
61  }
62 
63  std::string PUGIXML_DOMNode::getName()
64  {
65  return m_pNode.name();
66  }
67 
69  {
70  return m_pNode.value();
71  }
72 
74  {
75  }
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 }
FIX::PUGIXML_DOMNode::m_pNode
pugi::xml_node m_pNode
Definition: PUGIXML_DOMDocument.h:77
FIX::DOMAttributes::map
std::map< std::string, std::string > map
Definition: DOMDocument.h:55
FIX::PUGIXML_DOMAttributes::m_pNode
pugi::xml_node m_pNode
Definition: PUGIXML_DOMDocument.h:76
FIX::DOMAttributesPtr
SmartPtr< DOMAttributes > DOMAttributesPtr
Definition: DOMDocument.h:45
FIX::PUGIXML_DOMNode::PUGIXML_DOMNode
PUGIXML_DOMNode(pugi::xml_node pNode)
Definition: PUGIXML_DOMDocument.h:66
FIX::PUGIXML_DOMDocument::xml
bool xml(std::ostream &)
Definition: PUGIXML_DOMDocument.cpp:117
FIX::PUGIXML_DOMNode
XML node as represented by pugixml.
Definition: PUGIXML_DOMDocument.h:63
FIX::PUGIXML_DOMDocument::load
bool load(std::istream &)
Definition: PUGIXML_DOMDocument.cpp:99
FIX::PUGIXML_DOMAttributes::get
bool get(const std::string &, std::string &)
Definition: PUGIXML_DOMDocument.cpp:48
FIX::ConfigError
Application is not configured correctly
Definition: Exceptions.h:104
FIX::PUGIXML_DOMNode::getAttributes
DOMAttributesPtr getAttributes()
Definition: PUGIXML_DOMDocument.cpp:75
FIX::DOMNodePtr
SmartPtr< DOMNode > DOMNodePtr
Definition: DOMDocument.h:59
FIX::PUGIXML_DOMDocument::m_pDoc
pugi::xml_document m_pDoc
Definition: PUGIXML_DOMDocument.h:94
FIX::PUGIXML_DOMNode::getNextSiblingNode
DOMNodePtr getNextSiblingNode()
Definition: PUGIXML_DOMDocument.cpp:68
PUGIXML_DOMDocument.h
FIX::PUGIXML_DOMDocument::getNode
DOMNodePtr getNode(const std::string &)
Definition: PUGIXML_DOMDocument.cpp:122
FIX::PUGIXML_DOMNode::getText
std::string getText()
Definition: PUGIXML_DOMDocument.cpp:85
FIX
Definition: Acceptor.cpp:34
FIX::PUGIXML_DOMDocument::~PUGIXML_DOMDocument
~PUGIXML_DOMDocument()
Definition: PUGIXML_DOMDocument.cpp:94
FIX::PUGIXML_DOMDocument::PUGIXML_DOMDocument
PUGIXML_DOMDocument()
Definition: PUGIXML_DOMDocument.cpp:90
FIX::PUGIXML_DOMAttributes::toMap
DOMAttributes::map toMap()
Definition: PUGIXML_DOMDocument.cpp:56
FIX::PUGIXML_DOMAttributes
XML attribute as represented by pugixml.
Definition: PUGIXML_DOMDocument.h:49
FIX::PUGIXML_DOMNode::getName
std::string getName()
Definition: PUGIXML_DOMDocument.cpp:80
FIX::PUGIXML_DOMNode::getFirstChildNode
DOMNodePtr getFirstChildNode()
Definition: PUGIXML_DOMDocument.cpp:61

Generated on Wed Apr 29 2020 19:41:30 for QuickFIX by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2001