Changeset 42:6f97b6d207aa in rrlib_xml


Ignore:
Timestamp:
16.06.2012 19:08:32 (7 years ago)
Author:
Tobias Föhst <foehst@…>
Branch:
default
Phase:
public
Message:

Renamed to rrlib_xml and stripped XML from class names

Files:
2 edited
6 moved

Legend:

Unmodified
Added
Removed
  • make.xml

    r41 r42  
    33<targets> 
    44 
    5   <rrlib name="xml2_wrapper" 
     5  <rrlib name="xml" 
    66        libs="xml2"> 
    77    <sources> 
    88      tCleanupHandler.h 
    9       tXML2WrapperException.h 
     9      tException.h 
    1010      *.cpp 
    1111    </sources> 
  • tCleanupHandler.h

    r39 r42  
    3232 */ 
    3333//---------------------------------------------------------------------- 
    34 #ifndef __rrlib__xml2_wrapper__tCleanupHandler_h__ 
    35 #define __rrlib__xml2_wrapper__tCleanupHandler_h__ 
     34#ifndef __rrlib__xml__tCleanupHandler_h__ 
     35#define __rrlib__xml__tCleanupHandler_h__ 
    3636 
    3737//---------------------------------------------------------------------- 
     
    5858namespace rrlib 
    5959{ 
    60 namespace xml2 
     60namespace xml 
    6161{ 
    6262 
  • tDocument.cpp

    r40 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    tXMLDocument.cpp 
     22/*!\file    tDocument.cpp 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    2828 */ 
    2929//---------------------------------------------------------------------- 
    30 #include "rrlib/xml2_wrapper/tXMLDocument.h" 
     30#include "rrlib/xml/tDocument.h" 
    3131 
    3232//---------------------------------------------------------------------- 
     
    3838// Internal includes with "" 
    3939//---------------------------------------------------------------------- 
    40 #include "rrlib/xml2_wrapper/tXML2WrapperException.h" 
    41 #include "rrlib/xml2_wrapper/tCleanupHandler.h" 
     40#include "rrlib/xml/tException.h" 
     41#include "rrlib/xml/tCleanupHandler.h" 
    4242 
    4343//---------------------------------------------------------------------- 
     
    5555namespace rrlib 
    5656{ 
    57 namespace xml2 
     57namespace xml 
    5858{ 
    5959 
     
    7171 
    7272//---------------------------------------------------------------------- 
    73 // tXMLDocument constructors 
     73// tDocument constructors 
    7474//---------------------------------------------------------------------- 
    75 tXMLDocument::tXMLDocument() 
     75tDocument::tDocument() 
    7676  : document(xmlNewDoc(reinterpret_cast<const xmlChar *>("1.0"))), 
    7777    root_node(0) 
     
    8181} 
    8282 
    83 tXMLDocument::tXMLDocument(const std::string &file_name, bool validate) 
     83tDocument::tDocument(const std::string &file_name, bool validate) 
    8484  : document(xmlReadFile(file_name.c_str(), 0, validate ? XML_PARSE_DTDVALID : 0)), 
    85     root_node(reinterpret_cast<tXMLNode *>(xmlDocGetRootElement(this->document))) 
     85    root_node(reinterpret_cast<tNode *>(xmlDocGetRootElement(this->document))) 
    8686{ 
    8787  assert(this->document); 
    8888  if (!this->document) 
    8989  { 
    90     throw tXML2WrapperException("Could not parse XML file `" + file_name + "'!"); 
     90    throw tException("Could not parse XML file `" + file_name + "'!"); 
    9191  } 
    9292  tCleanupHandler::Instance(); 
    9393} 
    9494 
    95 tXMLDocument::tXMLDocument(const void *buffer, size_t size, bool validate) 
     95tDocument::tDocument(const void *buffer, size_t size, bool validate) 
    9696  : document(xmlReadMemory(reinterpret_cast<const char *>(buffer), size, "noname.xml", 0, validate ? XML_PARSE_DTDVALID : 0)), 
    97     root_node(reinterpret_cast<tXMLNode *>(xmlDocGetRootElement(this->document))) 
     97    root_node(reinterpret_cast<tNode *>(xmlDocGetRootElement(this->document))) 
    9898{ 
    9999  if (!this->document) 
    100100  { 
    101     throw tXML2WrapperException("Could not parse XML from memory buffer `" + std::string(reinterpret_cast<const char *>(buffer)) + "'!"); 
     101    throw tException("Could not parse XML from memory buffer `" + std::string(reinterpret_cast<const char *>(buffer)) + "'!"); 
    102102  } 
    103103  tCleanupHandler::Instance(); 
    104104} 
    105105 
    106 tXMLDocument::tXMLDocument(tXMLDocument && other) 
     106tDocument::tDocument(tDocument && other) 
    107107  : document(0), 
    108108    root_node(0) 
     
    113113 
    114114//---------------------------------------------------------------------- 
    115 // tXMLDocument destructor 
     115// tDocument destructor 
    116116//---------------------------------------------------------------------- 
    117 tXMLDocument::~tXMLDocument() 
     117tDocument::~tDocument() 
    118118{ 
    119119  if (this->document) 
     
    124124 
    125125//---------------------------------------------------------------------- 
    126 // tXMLDocument operator = 
     126// tDocument operator = 
    127127//---------------------------------------------------------------------- 
    128 tXMLDocument &tXMLDocument::operator = (const tXMLDocument & other) 
     128tDocument &tDocument::operator = (const tDocument & other) 
    129129{ 
    130130  if (this == &other) 
     
    134134  xmlFreeDoc(this->document); 
    135135  this->document = xmlCopyDoc(other.document, true); 
    136   this->root_node = reinterpret_cast<tXMLNode *>(xmlDocGetRootElement(this->document)); 
     136  this->root_node = reinterpret_cast<tNode *>(xmlDocGetRootElement(this->document)); 
    137137  return *this; 
    138138} 
    139139 
    140140//---------------------------------------------------------------------- 
    141 // tXMLDocument RootNode 
     141// tDocument RootNode 
    142142//---------------------------------------------------------------------- 
    143 tXMLNode &tXMLDocument::RootNode() 
     143tNode &tDocument::RootNode() 
    144144{ 
    145145  if (!this->root_node) 
    146146  { 
    147     throw tXML2WrapperException("No root node defined for this document!"); 
     147    throw tException("No root node defined for this document!"); 
    148148  } 
    149149  return *this->root_node; 
     
    151151 
    152152//---------------------------------------------------------------------- 
    153 // tXMLDocument AddRootNode 
     153// tDocument AddRootNode 
    154154//---------------------------------------------------------------------- 
    155 tXMLNode &tXMLDocument::AddRootNode(const std::string &name) 
     155tNode &tDocument::AddRootNode(const std::string &name) 
    156156{ 
    157157  if (this->root_node) 
    158158  { 
    159     throw tXML2WrapperException("Root node already exists with name `" + name + "'!"); 
     159    throw tException("Root node already exists with name `" + name + "'!"); 
    160160  } 
    161   this->root_node = reinterpret_cast<tXMLNode *>(xmlNewNode(0, reinterpret_cast<const xmlChar *>(name.c_str()))); 
     161  this->root_node = reinterpret_cast<tNode *>(xmlNewNode(0, reinterpret_cast<const xmlChar *>(name.c_str()))); 
    162162  xmlDocSetRootElement(this->document, this->root_node); 
    163163  return *this->root_node; 
     
    165165 
    166166//---------------------------------------------------------------------- 
    167 // tXMLDocument WriteToFile 
     167// tDocument WriteToFile 
    168168//---------------------------------------------------------------------- 
    169 void tXMLDocument::WriteToFile(const std::string &file_name, int compression) const 
     169void tDocument::WriteToFile(const std::string &file_name, int compression) const 
    170170{ 
    171171  if (compression) 
  • tDocument.h

    r38 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    tXMLDocument.h 
     22/*!\file    tDocument.h 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    2626 * \date    2010-09-18 
    2727 * 
    28  * \brief Contains tXMLDocument 
     28 * \brief Contains tDocument 
    2929 * 
    30  * \b tXMLDocument 
     30 * \b tDocument 
    3131 * 
    3232 * If an XML document is loaded for full access to its content, a DOM 
    3333 * tree is generated consisting of nodes of with attributes. This class 
    3434 * implements parsing and validating an XML file as well as accessing 
    35  * the DOM tree through instances of tXMLNode, featuring lazy evaluation. 
     35 * the DOM tree through instances of tNode, featuring lazy evaluation. 
    3636 * That means wrapping instances are not created before they are used. 
    3737 * 
    3838 */ 
    3939//---------------------------------------------------------------------- 
    40 #ifndef __rrlib__xml2_wrapper__tXMLDocument_h__ 
    41 #define __rrlib__xml2_wrapper__tXMLDocument_h__ 
     40#ifndef __rrlib__xml__tDocument_h__ 
     41#define __rrlib__xml__tDocument_h__ 
    4242 
    4343//---------------------------------------------------------------------- 
     
    5353// Internal includes with "" 
    5454//---------------------------------------------------------------------- 
    55 #include "rrlib/xml2_wrapper/tXMLNode.h" 
     55#include "rrlib/xml/tNode.h" 
    5656 
    5757//---------------------------------------------------------------------- 
     
    6464namespace rrlib 
    6565{ 
    66 namespace xml2 
     66namespace xml 
    6767{ 
    6868 
     
    7878 *  tree is generated consisting of nodes with attributes. This class 
    7979 *  implements parsing and validating an XML file as well as accessing 
    80  *  the DOM tree through instances of tXMLNode, featuring lazy evaluation. 
     80 *  the DOM tree through instances of tNode, featuring lazy evaluation. 
    8181 *  That means wrapping instances are not created before they are used. 
    8282 * 
    8383 */ 
    84 class tXMLDocument 
     84class tDocument 
    8585{ 
    8686 
     
    9090public: 
    9191 
    92   /*! The ctor of an empty tXMLDocument 
     92  /*! The ctor of an empty tDocument 
    9393   * 
    9494   * This ctor creates a new xml document 
    9595   */ 
    96   tXMLDocument(); 
     96  tDocument(); 
    9797 
    98   /*! The ctor of tXMLDocument from a given file 
     98  /*! The ctor of tDocument from a given file 
    9999   * 
    100100   * This ctor reads and parses a file with given name into a XML DOM 
     
    103103   * DTD specification. 
    104104   * 
    105    * \exception tXML2WrapperException is thrown if the file was not found or could not be parsed 
     105   * \exception tException is thrown if the file was not found or could not be parsed 
    106106   * 
    107107   * \param file_name   The name of the file to load 
    108108   * \param validate    Whether the validation should be processed or not 
    109109   */ 
    110   explicit tXMLDocument(const std::string &file_name, bool validate = true); 
     110  explicit tDocument(const std::string &file_name, bool validate = true); 
    111111 
    112   /*! The ctor of tXMLDocument from a memory buffer 
     112  /*! The ctor of tDocument from a memory buffer 
    113113   * 
    114114   * This ctor reads and parses XML content given in a memory buffer into a XML DOM 
     
    117117   * DTD specification. 
    118118   * 
    119    * \exception tXML2WrapperException is thrown if the memory buffer could not be parsed 
     119   * \exception tException is thrown if the memory buffer could not be parsed 
    120120   * 
    121121   * \param buffer      Pointer to the memory buffer with XML content to be parsed 
     
    123123   * \param validate    Whether the validation should be processed or not 
    124124   */ 
    125   tXMLDocument(const void *buffer, size_t size, bool validate = true); 
     125  tDocument(const void *buffer, size_t size, bool validate = true); 
    126126 
    127127  /*! 
    128128   * move constructor 
    129129   */ 
    130   tXMLDocument(tXMLDocument && other); 
     130  tDocument(tDocument && other); 
    131131 
    132   /*! The dtor of tXMLDocument 
     132  /*! The dtor of tDocument 
    133133   */ 
    134   ~tXMLDocument(); 
     134  ~tDocument(); 
    135135 
    136   /*! Assign operator for tXMLDocument 
     136  /*! Assign operator for tDocument 
    137137   */ 
    138   tXMLDocument& operator=(const tXMLDocument& other); 
     138  tDocument& operator=(const tDocument& other); 
    139139 
    140140  /*! Get the root node of the DOM tree stored for this document 
     
    145145   * \returns A reference to the root node 
    146146   */ 
    147   tXMLNode &RootNode(); 
     147  tNode &RootNode(); 
    148148 
    149   inline const tXMLNode &RootNode() const 
     149  inline const tNode &RootNode() const 
    150150  { 
    151     return const_cast<tXMLDocument *>(this)->RootNode(); 
     151    return const_cast<tDocument *>(this)->RootNode(); 
    152152  } 
    153153 
     
    158158   * is fixed and additional calls to this method will throw an exception. 
    159159   * 
    160    * \exception tXML2WrapperException is thrown if the document already had a root node 
     160   * \exception tException is thrown if the document already had a root node 
    161161   * 
    162162   * \param name   The name of the root node 
     
    164164   * \returns A reference to the newly created root node 
    165165   */ 
    166   tXMLNode &AddRootNode(const std::string &name); 
     166  tNode &AddRootNode(const std::string &name); 
    167167 
    168168  /*! Write the XML document to a file 
     
    182182 
    183183  xmlDocPtr document; 
    184   mutable tXMLNode *root_node; 
     184  mutable tNode *root_node; 
    185185 
    186   tXMLDocument(const tXMLDocument&); // generated copy-constructor is not safe 
     186  tDocument(const tDocument&); // generated copy-constructor is not safe 
    187187}; 
    188188 
  • tException.h

    r40 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    tXML2WrapperException.h 
     22/*!\file    tException.h 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    2626 * \date    2010-06-26 
    2727 * 
    28  * \brief   Contains tXML2WrapperException 
     28 * \brief   Contains tException 
    2929 * 
    30  * \b tXML2WrapperException 
     30 * \b tException 
    3131 * 
    3232 * Runtime errors that come along with invalid XML input are handled 
    33  * by throwing an instance of tXML2WrapperException, which is the only 
     33 * by throwing an instance of tException, which is the only 
    3434 * proper way to cope with construction errors. 
    35  * tXML2WrapperException is derived from std::runtime_error and thus 
     35 * tException is derived from std::runtime_error and thus 
    3636 * can be caught either especially for this library or in a general 
    3737 * runtime_error block. 
     
    3939 */ 
    4040//---------------------------------------------------------------------- 
    41 #ifndef __rrlib__xml2_wrapper__tXML2WrapperException_h__ 
    42 #define __rrlib__xml2_wrapper__tXML2WrapperException_h__ 
     41#ifndef __rrlib__xml__tException_h__ 
     42#define __rrlib__xml__tException_h__ 
    4343 
    4444//---------------------------------------------------------------------- 
     
    6060namespace rrlib 
    6161{ 
    62 namespace xml2 
     62namespace xml 
    6363{ 
    6464 
     
    7777 * 
    7878 */ 
    79 class tXML2WrapperException : public std::runtime_error 
     79class tException : public std::runtime_error 
    8080{ 
    8181 
     
    8585public: 
    8686 
    87   /*! The ctor of tXML2WrapperException 
     87  /*! The ctor of tException 
    8888   * 
    8989   * This ctor forwards instantiation of an exception object to 
     
    9292   * \param message   A message that describes the error 
    9393   */ 
    94   tXML2WrapperException(const std::string &message) 
     94  tException(const std::string &message) 
    9595    : std::runtime_error(message) 
    9696  {} 
  • tNode.cpp

    r39 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    tXMLNode.cpp 
     22/*!\file    tNode.cpp 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    2828 */ 
    2929//---------------------------------------------------------------------- 
    30 #include "rrlib/xml2_wrapper/tXMLNode.h" 
     30#include "rrlib/xml/tNode.h" 
    3131 
    3232//---------------------------------------------------------------------- 
     
    5353namespace rrlib 
    5454{ 
    55 namespace xml2 
     55namespace xml 
    5656{ 
    5757 
     
    6969 
    7070//---------------------------------------------------------------------- 
    71 // tXMLNode destructor 
    72 //---------------------------------------------------------------------- 
    73 tXMLNode::~tXMLNode() 
    74 { 
    75   static_assert(sizeof(tXMLNode) == sizeof(xmlNode), "Do not add any variables or virtual methods to tXMLNode!"); 
    76 } 
    77  
    78 //---------------------------------------------------------------------- 
    79 // tXMLNode IsInSubtreeOf 
    80 //---------------------------------------------------------------------- 
    81 const bool tXMLNode::IsInSubtreeOf(const tXMLNode &node) const 
    82 { 
    83   const tXMLNode *current_node = this; 
     71// tNode destructor 
     72//---------------------------------------------------------------------- 
     73tNode::~tNode() 
     74{ 
     75  static_assert(sizeof(tNode) == sizeof(xmlNode), "Do not add any variables or virtual methods to tNode!"); 
     76} 
     77 
     78//---------------------------------------------------------------------- 
     79// tNode IsInSubtreeOf 
     80//---------------------------------------------------------------------- 
     81const bool tNode::IsInSubtreeOf(const tNode &node) const 
     82{ 
     83  const tNode *current_node = this; 
    8484  do 
    8585  { 
     
    8989    } 
    9090  } 
    91   while ((current_node = reinterpret_cast<tXMLNode *>(current_node->parent))); 
     91  while ((current_node = reinterpret_cast<tNode *>(current_node->parent))); 
    9292  return false; 
    9393} 
    9494 
    9595//---------------------------------------------------------------------- 
    96 // tXMLNode Name 
    97 //---------------------------------------------------------------------- 
    98 const std::string tXMLNode::Name() const 
     96// tNode Name 
     97//---------------------------------------------------------------------- 
     98const std::string tNode::Name() const 
    9999{ 
    100100  return reinterpret_cast<const char *>(this->name); 
     
    102102 
    103103//---------------------------------------------------------------------- 
    104 // tXMLNode ChildrenEnd 
    105 //---------------------------------------------------------------------- 
    106 const tXMLNode::iterator &tXMLNode::ChildrenEnd() 
     104// tNode ChildrenEnd 
     105//---------------------------------------------------------------------- 
     106const tNode::iterator &tNode::ChildrenEnd() 
    107107{ 
    108108  static iterator end; 
     
    110110} 
    111111 
    112 const tXMLNode::const_iterator &tXMLNode::ChildrenEnd() const 
     112const tNode::const_iterator &tNode::ChildrenEnd() const 
    113113{ 
    114114  static const_iterator end; 
     
    117117 
    118118//---------------------------------------------------------------------- 
    119 // tXMLNode FirstChild 
    120 //---------------------------------------------------------------------- 
    121 tXMLNode &tXMLNode::FirstChild() 
     119// tNode FirstChild 
     120//---------------------------------------------------------------------- 
     121tNode &tNode::FirstChild() 
    122122{ 
    123123  if (!this->HasChildren()) 
    124124  { 
    125     throw tXML2WrapperException("Node has no children!"); 
     125    throw tException("Node has no children!"); 
    126126  } 
    127127  return *this->ChildrenBegin(); 
     
    129129 
    130130//---------------------------------------------------------------------- 
    131 // tXMLNode AddChildNode 
    132 //---------------------------------------------------------------------- 
    133 tXMLNode &tXMLNode::AddChildNode(const std::string &name, const std::string &content) 
     131// tNode AddChildNode 
     132//---------------------------------------------------------------------- 
     133tNode &tNode::AddChildNode(const std::string &name, const std::string &content) 
    134134{ 
    135135  const char* c = (content.length() == 0) ? NULL : content.c_str(); 
    136   return reinterpret_cast<tXMLNode &>(*xmlNewChild(this, 0, reinterpret_cast<const xmlChar *>(name.c_str()), reinterpret_cast<const xmlChar *>(c))); 
    137 } 
    138  
    139 tXMLNode &tXMLNode::AddChildNode(tXMLNode &node, bool copy) 
    140 { 
    141   tXMLNode *child = &node; 
     136  return reinterpret_cast<tNode &>(*xmlNewChild(this, 0, reinterpret_cast<const xmlChar *>(name.c_str()), reinterpret_cast<const xmlChar *>(c))); 
     137} 
     138 
     139tNode &tNode::AddChildNode(tNode &node, bool copy) 
     140{ 
     141  tNode *child = &node; 
    142142  if (copy) 
    143143  { 
    144     child = reinterpret_cast<tXMLNode *>(xmlDocCopyNode(child, this->doc, 1)); 
     144    child = reinterpret_cast<tNode *>(xmlDocCopyNode(child, this->doc, 1)); 
    145145  } 
    146146  if (child->doc != this->doc) 
     
    151151  { 
    152152    assert(!copy); 
    153     throw tXML2WrapperException("Cannot add node as child to its own subtree without copying!"); 
     153    throw tException("Cannot add node as child to its own subtree without copying!"); 
    154154  } 
    155155  xmlAddChild(this, child); 
     
    158158 
    159159//---------------------------------------------------------------------- 
    160 // tXMLNode RemoveChildNode 
    161 //---------------------------------------------------------------------- 
    162 void tXMLNode::RemoveChildNode(tXMLNode &node) 
     160// tNode RemoveChildNode 
     161//---------------------------------------------------------------------- 
     162void tNode::RemoveChildNode(tNode &node) 
    163163{ 
    164164  iterator it = std::find(this->ChildrenBegin(), this->ChildrenEnd(), node); 
    165165  if (it == this->ChildrenEnd()) 
    166166  { 
    167     throw tXML2WrapperException("Given node is not a child of this!"); 
     167    throw tException("Given node is not a child of this!"); 
    168168  } 
    169169  it->FreeNode(); 
     
    171171 
    172172//---------------------------------------------------------------------- 
    173 // tXMLNode NextSiblingsEnd 
    174 //---------------------------------------------------------------------- 
    175 const tXMLNode::iterator &tXMLNode::NextSiblingsEnd() 
     173// tNode NextSiblingsEnd 
     174//---------------------------------------------------------------------- 
     175const tNode::iterator &tNode::NextSiblingsEnd() 
    176176{ 
    177177  static iterator end; 
     
    179179} 
    180180 
    181 const tXMLNode::const_iterator &tXMLNode::NextSiblingsEnd() const 
     181const tNode::const_iterator &tNode::NextSiblingsEnd() const 
    182182{ 
    183183  static const_iterator end; 
     
    186186 
    187187//---------------------------------------------------------------------- 
    188 // tXMLNode NextSibling 
    189 //---------------------------------------------------------------------- 
    190 tXMLNode &tXMLNode::NextSibling() 
     188// tNode NextSibling 
     189//---------------------------------------------------------------------- 
     190tNode &tNode::NextSibling() 
    191191{ 
    192192  if (!this->HasNextSibling()) 
    193193  { 
    194     throw tXML2WrapperException("Node has no sibling!"); 
     194    throw tException("Node has no sibling!"); 
    195195  } 
    196196  return *this->NextSiblingsBegin(); 
     
    198198 
    199199//---------------------------------------------------------------------- 
    200 // tXMLNode AddNextSibling 
    201 //---------------------------------------------------------------------- 
    202 tXMLNode &tXMLNode::AddNextSibling(const std::string &name, const std::string &content) 
    203 { 
    204   tXMLNode *sibling = reinterpret_cast<tXMLNode *>(xmlNewNode(0, reinterpret_cast<const xmlChar *>(name.c_str()))); 
     200// tNode AddNextSibling 
     201//---------------------------------------------------------------------- 
     202tNode &tNode::AddNextSibling(const std::string &name, const std::string &content) 
     203{ 
     204  tNode *sibling = reinterpret_cast<tNode *>(xmlNewNode(0, reinterpret_cast<const xmlChar *>(name.c_str()))); 
    205205  if (content != "") 
    206206  { 
    207207    xmlNodeSetContentLen(sibling, reinterpret_cast<const xmlChar *>(content.c_str()), content.length()); 
    208208  } 
    209   return reinterpret_cast<tXMLNode &>(*xmlAddNextSibling(this, sibling)); 
    210 } 
    211  
    212 tXMLNode &tXMLNode::AddNextSibling(tXMLNode &node, bool copy) 
    213 { 
    214   tXMLNode *sibling = &node; 
     209  return reinterpret_cast<tNode &>(*xmlAddNextSibling(this, sibling)); 
     210} 
     211 
     212tNode &tNode::AddNextSibling(tNode &node, bool copy) 
     213{ 
     214  tNode *sibling = &node; 
    215215  if (copy) 
    216216  { 
    217     sibling = reinterpret_cast<tXMLNode *>(xmlDocCopyNode(sibling, this->doc, 1)); 
     217    sibling = reinterpret_cast<tNode *>(xmlDocCopyNode(sibling, this->doc, 1)); 
    218218  } 
    219219  if (sibling->doc != this->doc) 
     
    224224  { 
    225225    assert(!copy); 
    226     throw tXML2WrapperException("Cannot add node as sibling in its own subtree without copying!"); 
     226    throw tException("Cannot add node as sibling in its own subtree without copying!"); 
    227227  } 
    228228  xmlAddNextSibling(this, sibling); 
     
    231231 
    232232//---------------------------------------------------------------------- 
    233 // tXMLNode GetTextContent 
    234 //---------------------------------------------------------------------- 
    235 const std::string tXMLNode::GetTextContent() const 
    236 { 
    237   xmlChar *content = xmlNodeGetContent(const_cast<tXMLNode *>(this)); 
     233// tNode GetTextContent 
     234//---------------------------------------------------------------------- 
     235const std::string tNode::GetTextContent() const 
     236{ 
     237  xmlChar *content = xmlNodeGetContent(const_cast<tNode *>(this)); 
    238238  std::string result(reinterpret_cast<const char *>(content)); 
    239239  xmlFree(content); 
     
    242242 
    243243//---------------------------------------------------------------------- 
    244 // tXMLNode AddTextContent 
    245 //---------------------------------------------------------------------- 
    246 void tXMLNode::AddTextContent(const std::string &content) 
     244// tNode AddTextContent 
     245//---------------------------------------------------------------------- 
     246void tNode::AddTextContent(const std::string &content) 
    247247{ 
    248248  xmlNodeAddContentLen(this, reinterpret_cast<const xmlChar *>(content.c_str()), content.length()); 
     
    250250 
    251251//---------------------------------------------------------------------- 
    252 // tXMLNode SetContent 
    253 //---------------------------------------------------------------------- 
    254 void tXMLNode::SetContent(const std::string &content) 
     252// tNode SetContent 
     253//---------------------------------------------------------------------- 
     254void tNode::SetContent(const std::string &content) 
    255255{ 
    256256  xmlNodeSetContentLen(this, reinterpret_cast<const xmlChar *>(content.c_str()), content.length()); 
     
    258258 
    259259//---------------------------------------------------------------------- 
    260 // tXMLNode RemoveTextContent 
    261 //---------------------------------------------------------------------- 
    262 void tXMLNode::RemoveTextContent() 
    263 { 
    264   std::vector<tXMLNode *> nodes_to_delete; 
     260// tNode RemoveTextContent 
     261//---------------------------------------------------------------------- 
     262void tNode::RemoveTextContent() 
     263{ 
     264  std::vector<tNode *> nodes_to_delete; 
    265265  for (xmlNodePtr child_node = this->children; child_node; child_node = child_node->next) 
    266266  { 
    267267    if (xmlNodeIsText(child_node)) 
    268268    { 
    269       nodes_to_delete.push_back(reinterpret_cast<tXMLNode *>(child_node)); 
     269      nodes_to_delete.push_back(reinterpret_cast<tNode *>(child_node)); 
    270270    } 
    271271  } 
    272   for (std::vector<tXMLNode *>::iterator it = nodes_to_delete.begin(); it != nodes_to_delete.end(); ++it) 
     272  for (std::vector<tNode *>::iterator it = nodes_to_delete.begin(); it != nodes_to_delete.end(); ++it) 
    273273  { 
    274274    (*it)->FreeNode(); 
     
    277277 
    278278//---------------------------------------------------------------------- 
    279 // tXMLNode SetStringAttribute 
    280 //---------------------------------------------------------------------- 
    281 void tXMLNode::SetStringAttribute(const std::string &name, const std::string &value, bool create) 
     279// tNode SetStringAttribute 
     280//---------------------------------------------------------------------- 
     281void tNode::SetStringAttribute(const std::string &name, const std::string &value, bool create) 
    282282{ 
    283283  if (!this->HasAttribute(name)) 
     
    288288      return; 
    289289    } 
    290     throw tXML2WrapperException("Attribute `" + name + "' does not exist in this node and creation was disabled!"); 
     290    throw tException("Attribute `" + name + "' does not exist in this node and creation was disabled!"); 
    291291  } 
    292292  xmlSetProp(this, reinterpret_cast<const xmlChar *>(name.c_str()), reinterpret_cast<const xmlChar *>(value.c_str())); 
     
    294294 
    295295//---------------------------------------------------------------------- 
    296 // tXMLNode RemoveAttribute 
    297 //---------------------------------------------------------------------- 
    298 void tXMLNode::RemoveAttribute(const std::string &name) 
     296// tNode RemoveAttribute 
     297//---------------------------------------------------------------------- 
     298void tNode::RemoveAttribute(const std::string &name) 
    299299{ 
    300300  xmlAttrPtr attr = xmlHasProp(this, reinterpret_cast<const xmlChar *>(name.c_str())); 
     
    306306 
    307307//---------------------------------------------------------------------- 
    308 // tXMLNode GetXMLDump 
    309 //---------------------------------------------------------------------- 
    310 const std::string tXMLNode::GetXMLDump(bool format) const 
     308// tNode GetXMLDump 
     309//---------------------------------------------------------------------- 
     310const std::string tNode::GetXMLDump(bool format) const 
    311311{ 
    312312  xmlBufferPtr buffer = xmlBufferCreate(); 
    313   xmlNodeDump(buffer, this->doc, const_cast<tXMLNode *>(this), 0, format); 
     313  xmlNodeDump(buffer, this->doc, const_cast<tNode *>(this), 0, format); 
    314314  std::string result(reinterpret_cast<const char *>(buffer->content)); 
    315315  xmlBufferFree(buffer); 
  • tNode.h

    r38 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    tXMLNode.h 
     22/*!\file    tNode.h 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    2626 * \date    2010-06-24 
    2727 * 
    28  * \brief Contains tXMLNode 
     28 * \brief Contains tNode 
    2929 * 
    30  * \b tXMLNode 
     30 * \b tNode 
    3131 * 
    3232 * If an XML document is loaded for full access to its content, a DOM 
     
    3838 */ 
    3939//---------------------------------------------------------------------- 
    40 #ifndef __rrlib__xml2_wrapper__tXMLNode_h__ 
    41 #define __rrlib__xml2_wrapper__tXMLNode_h__ 
     40#ifndef __rrlib__xml__tNode_h__ 
     41#define __rrlib__xml__tNode_h__ 
    4242 
    4343//---------------------------------------------------------------------- 
     
    6161// Internal includes with "" 
    6262//---------------------------------------------------------------------- 
    63 #include "rrlib/xml2_wrapper/tXML2WrapperException.h" 
     63#include "rrlib/xml/tException.h" 
    6464 
    6565//---------------------------------------------------------------------- 
     
    7373namespace rrlib 
    7474{ 
    75 namespace xml2 
     75namespace xml 
    7676{ 
    7777 
     
    9191 * 
    9292 */ 
    93 class tXMLNode : protected xmlNode, boost::noncopyable 
     93class tNode : protected xmlNode, boost::noncopyable 
    9494{ 
    95   friend class tXMLDocument; 
     95  friend class tDocument; 
    9696 
    9797//---------------------------------------------------------------------- 
     
    102102  class const_iterator; 
    103103 
    104   class iterator : public std::iterator<std::forward_iterator_tag, tXMLNode, size_t> 
     104  class iterator : public std::iterator<std::forward_iterator_tag, tNode, size_t> 
    105105  { 
    106106    friend class const_iterator; 
     
    130130      do 
    131131      { 
    132         this->element = reinterpret_cast<tXMLNode *>(this->element->next); 
     132        this->element = reinterpret_cast<tNode *>(this->element->next); 
    133133      } 
    134134      while (this->element && this->element->type != XML_ELEMENT_NODE); 
     
    152152  }; 
    153153 
    154   class const_iterator : public std::iterator<std::forward_iterator_tag, const tXMLNode, size_t> 
     154  class const_iterator : public std::iterator<std::forward_iterator_tag, const tNode, size_t> 
    155155  { 
    156156    pointer element; 
     
    165165      } 
    166166    } 
    167     // NOTE: the clarification tXMLNode::iterator is necessary for gcc 4.5.2 -> DO NOT REMOVE IT!!! 
    168     inline const_iterator(const  tXMLNode::iterator &other) : element(other.element) {}; 
     167    // NOTE: the clarification tNode::iterator is necessary for gcc 4.5.2 -> DO NOT REMOVE IT!!! 
     168    inline const_iterator(const  tNode::iterator &other) : element(other.element) {}; 
    169169 
    170170    inline reference operator*() const 
     
    181181      do 
    182182      { 
    183         this->element = reinterpret_cast<tXMLNode *>(this->element->next); 
     183        this->element = reinterpret_cast<tNode *>(this->element->next); 
    184184      } 
    185185      while (this->element && this->element->type != XML_ELEMENT_NODE); 
     
    203203  }; 
    204204 
    205   /*! The dtor of tXMLNode 
    206    */ 
    207   ~tXMLNode(); 
     205  /*! The dtor of tNode 
     206   */ 
     207  ~tNode(); 
    208208 
    209209  /*! Comparison of XML node objects (inequality) 
     
    225225   * \returns Whether the two nodes are the same or not 
    226226   */ 
    227   inline bool operator == (const tXMLNode &other) const 
     227  inline bool operator == (const tNode &other) const 
    228228  { 
    229229    return this == &other; 
     
    236236   * \returns Whether the two nodes are the same or not 
    237237   */ 
    238   inline bool operator != (const tXMLNode &other) const 
     238  inline bool operator != (const tNode &other) const 
    239239  { 
    240240    return !(*this == other); 
     
    250250   * \returns Whether \a this is contained within the subtree of \a node 
    251251   */ 
    252   const bool IsInSubtreeOf(const tXMLNode &node) const; 
     252  const bool IsInSubtreeOf(const tNode &node) const; 
    253253 
    254254  /*! Get the name of this node 
     
    267267  inline const iterator ChildrenBegin() 
    268268  { 
    269     return iterator(reinterpret_cast<tXMLNode *>(this->children)); 
     269    return iterator(reinterpret_cast<tNode *>(this->children)); 
    270270  } 
    271271 
     
    276276  inline const const_iterator ChildrenBegin() const 
    277277  { 
    278     return const_iterator(reinterpret_cast<tXMLNode *>(this->children)); 
     278    return const_iterator(reinterpret_cast<tNode *>(this->children)); 
    279279  } 
    280280 
     
    320320   * which is itself of type XML_ELEMENT_NODE. 
    321321   * 
    322    * \exception tXML2WrapperException is thrown if this node has not children of type XML_ELEMENT_NODE 
     322   * \exception tException is thrown if this node has not children of type XML_ELEMENT_NODE 
    323323   * 
    324324   * \returns Whether \a this has children or not 
    325325   */ 
    326   tXMLNode &FirstChild(); 
     326  tNode &FirstChild(); 
    327327 
    328328  /*! Get access to first child of this node in const context 
     
    331331   * which is itself of type XML_ELEMENT_NODE in const context. 
    332332   * 
    333    * \exception tXML2WrapperException is thrown if this node has not children of type XML_ELEMENT_NODE 
     333   * \exception tException is thrown if this node has not children of type XML_ELEMENT_NODE 
    334334   * 
    335335   * \returns Whether \a this has children or not 
    336336   */ 
    337   inline const tXMLNode &FirstChild() const 
    338   { 
    339     return const_cast<tXMLNode *>(this)->FirstChild(); 
     337  inline const tNode &FirstChild() const 
     338  { 
     339    return const_cast<tNode *>(this)->FirstChild(); 
    340340  } 
    341341 
     
    351351   * \returns A reference to the newly created node 
    352352   */ 
    353   tXMLNode &AddChildNode(const std::string &name, const std::string &content = ""); 
     353  tNode &AddChildNode(const std::string &name, const std::string &content = ""); 
    354354 
    355355  /*! Add an existing node as child to this node 
     
    362362   * to its new place and the old version remains at its origin. 
    363363   * 
    364    * \exception tXML2WrapperException is thrown if \this is contained in the subtree of \a node and \a copy is false 
     364   * \exception tException is thrown if \this is contained in the subtree of \a node and \a copy is false 
    365365   * 
    366366   * \param node   The node to be added 
     
    369369   * \returns A reference to the new child 
    370370   */ 
    371   tXMLNode &AddChildNode(tXMLNode &node, bool copy = false); 
     371  tNode &AddChildNode(tNode &node, bool copy = false); 
    372372 
    373373  /*! Remove a child node 
     
    375375   * Removes a given node from the children list of this node. 
    376376   * 
    377    * \exception tXML2WrapperException is thrown if \a node is not a child of \a this 
     377   * \exception tException is thrown if \a node is not a child of \a this 
    378378   * 
    379379   * \param node   The node to remove from the list 
    380380   */ 
    381   void RemoveChildNode(tXMLNode &node); 
     381  void RemoveChildNode(tNode &node); 
    382382 
    383383  /*! Get an iterator to the next of this node's siblings of type XML_ELEMENT_NODE 
     
    387387  inline const iterator NextSiblingsBegin() 
    388388  { 
    389     return iterator(reinterpret_cast<tXMLNode *>(this->next)); 
     389    return iterator(reinterpret_cast<tNode *>(this->next)); 
    390390  } 
    391391 
     
    396396  inline const const_iterator NextSiblingsBegin() const 
    397397  { 
    398     return const_iterator(reinterpret_cast<tXMLNode *>(this->next)); 
     398    return const_iterator(reinterpret_cast<tNode *>(this->next)); 
    399399  } 
    400400 
     
    429429   * which is itself of type XML_ELEMENT_NODE. 
    430430   * 
    431    * \exception tXML2WrapperException is thrown if this node has not children of type XML_ELEMENT_NODE 
     431   * \exception tException is thrown if this node has not children of type XML_ELEMENT_NODE 
    432432   * 
    433433   * \returns Whether \a this has children or not 
    434434   */ 
    435   tXMLNode &NextSibling(); 
     435  tNode &NextSibling(); 
    436436 
    437437  /*! Get access to first child of this node in const context 
     
    440440   * which is itself of type XML_ELEMENT_NODE in const context. 
    441441   * 
    442    * \exception tXML2WrapperException is thrown if this node has not children of type XML_ELEMENT_NODE 
     442   * \exception tException is thrown if this node has not children of type XML_ELEMENT_NODE 
    443443   * 
    444444   * \returns Whether \a this has children or not 
    445445   */ 
    446   inline const tXMLNode &NextSibling() const 
    447   { 
    448     return const_cast<tXMLNode *>(this)->NextSibling(); 
    449   } 
    450  
    451   tXMLNode &AddNextSibling(const std::string &name, const std::string &content = ""); 
     446  inline const tNode &NextSibling() const 
     447  { 
     448    return const_cast<tNode *>(this)->NextSibling(); 
     449  } 
     450 
     451  tNode &AddNextSibling(const std::string &name, const std::string &content = ""); 
    452452 
    453453  /*! Add an existing node as next sibling to this node 
     
    460460   * to its new place and the old version remains at its origin. 
    461461   * 
    462    * \exception tXML2WrapperException is thrown if \this is contained in the subtree of \a node and \a copy is false 
     462   * \exception tException is thrown if \this is contained in the subtree of \a node and \a copy is false 
    463463   * 
    464464   * \param node   The node to be added 
     
    467467   * \returns A reference to the new sibling 
    468468   */ 
    469   tXMLNode &AddNextSibling(tXMLNode &node, bool copy = false); 
     469  tNode &AddNextSibling(tNode &node, bool copy = false); 
    470470 
    471471  /*! Get the plain text content of this node 
     
    474474   * a std::string. 
    475475   * 
    476    * \exception tXML2WrapperException is thrown if the node does not contain plain text content 
     476   * \exception tException is thrown if the node does not contain plain text content 
    477477   * 
    478478   * \returns The plain text content 
     
    501501   * before accessing an attribute using its name gives information 
    502502   * about its availability and thus can be used to avoid runtime 
    503    * errors in form of instances of tXML2WrapperException. 
     503   * errors in form of instances of tException. 
    504504   * 
    505505   * \returns Whether this node has the given attribute or not 
     
    507507  inline const bool HasAttribute(const std::string &name) const 
    508508  { 
    509     return xmlHasProp(const_cast<tXMLNode *>(this), reinterpret_cast<const xmlChar *>(name.c_str())) != 0; 
     509    return xmlHasProp(const_cast<tNode *>(this), reinterpret_cast<const xmlChar *>(name.c_str())) != 0; 
    510510  } 
    511511 
     
    515515   * the given name, its value is returned by this method as string. 
    516516   * 
    517    * \exception tXML2WrapperException is thrown if the requested attribute is not available 
     517   * \exception tException is thrown if the requested attribute is not available 
    518518   * 
    519519   * \param name   The name of the attribute 
     
    523523  inline const std::string GetStringAttribute(const std::string &name) const 
    524524  { 
    525     xmlChar *temp = xmlGetProp(const_cast<tXMLNode *>(this), reinterpret_cast<const xmlChar *>(name.c_str())); 
     525    xmlChar *temp = xmlGetProp(const_cast<tNode *>(this), reinterpret_cast<const xmlChar *>(name.c_str())); 
    526526    if (!temp) 
    527527    { 
    528       throw tXML2WrapperException("Requested attribute `" + name + "' does not exist in this node!"); 
     528      throw tException("Requested attribute `" + name + "' does not exist in this node!"); 
    529529    } 
    530530    std::string result(reinterpret_cast<char *>(temp)); 
     
    538538   * the given name, its value is returned by this method as int. 
    539539   * 
    540    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     540   * \exception tException is thrown if the requested attribute's value is available or not a number 
    541541   * 
    542542   * \param name   The name of the attribute 
     
    555555   * the given name, its value is returned by this method as long int. 
    556556   * 
    557    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     557   * \exception tException is thrown if the requested attribute's value is available or not a number 
    558558   * 
    559559   * \param name   The name of the attribute 
     
    564564  inline const long int GetLongIntAttribute(const std::string &name, int base = 10) const 
    565565  { 
    566     return tXMLNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtol, base); 
     566    return tNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtol, base); 
    567567  } 
    568568 
     
    573573   * int. 
    574574   * 
    575    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     575   * \exception tException is thrown if the requested attribute's value is available or not a number 
    576576   * 
    577577   * \param name   The name of the attribute 
     
    582582  inline const long long int GetLongLongIntAttribute(const std::string &name, int base = 10) const 
    583583  { 
    584     return tXMLNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtoll, base); 
     584    return tNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtoll, base); 
    585585  } 
    586586 
     
    590590   * the given name, its value is returned by this method as float. 
    591591   * 
    592    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     592   * \exception tException is thrown if the requested attribute's value is available or not a number 
    593593   * 
    594594   * \param name   The name of the attribute 
     
    598598  inline const float GetFloatAttribute(const std::string &name) const 
    599599  { 
    600     return tXMLNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtof); 
     600    return tNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtof); 
    601601  } 
    602602 
     
    606606   * the given name, its value is returned by this method as double. 
    607607   * 
    608    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     608   * \exception tException is thrown if the requested attribute's value is available or not a number 
    609609   * 
    610610   * \param name   The name of the attribute 
     
    614614  inline const double GetDoubleAttribute(const std::string &name) const 
    615615  { 
    616     return tXMLNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtod); 
     616    return tNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtod); 
    617617  } 
    618618 
     
    622622   * the given name, its value is returned by this method as long double. 
    623623   * 
    624    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a number 
     624   * \exception tException is thrown if the requested attribute's value is available or not a number 
    625625   * 
    626626   * \param name   The name of the attribute 
     
    630630  inline const long double GetLongDoubleAttribute(const std::string &name) const 
    631631  { 
    632     return tXMLNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtold); 
     632    return tNode::ConvertStringToNumber(this->GetStringAttribute(name), std::strtold); 
    633633  } 
    634634 
     
    641641   * was found in the attribute. 
    642642   * 
    643    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not a member of given vector 
     643   * \exception tException is thrown if the requested attribute's value is available or not a member of given vector 
    644644   * 
    645645   * \param name         The name of the attribute 
     
    655655    if (it == enum_names.end()) 
    656656    { 
    657       throw tXML2WrapperException("Invalid value for " + this->Name() + "." + name + ": `" + value + "'"); 
     657      throw tException("Invalid value for " + this->Name() + "." + name + ": `" + value + "'"); 
    658658    } 
    659659    return static_cast<TEnum>(std::distance(enum_names.begin(), it)); 
     
    666666   * as bool. 
    667667   * 
    668    * \exception tXML2WrapperException is thrown if the requested attribute's value is available or not true/false 
     668   * \exception tException is thrown if the requested attribute's value is available or not true/false 
    669669   * 
    670670   * \param name   The name of the attribute 
     
    695695   * \note The value type must support streaming to be serialized 
    696696   * 
    697    * \exception tXML2WrapperException is thrown if the requested attribute does not exist and should not be created 
     697   * \exception tException is thrown if the requested attribute does not exist and should not be created 
    698698   * 
    699699   * \param name     The name of the attribute 
     
    714714   * into "true" and "false" instead of int representation. 
    715715   * 
    716    * \exception tXML2WrapperException is thrown if the requested attribute does not exist and should not be created 
     716   * \exception tException is thrown if the requested attribute does not exist and should not be created 
    717717   * 
    718718   * \param name     The name of the attribute 
     
    730730   * serialized via stringstream. 
    731731   * 
    732    * \exception tXML2WrapperException is thrown if the requested attribute does not exist and should not be created 
     732   * \exception tException is thrown if the requested attribute does not exist and should not be created 
    733733   * 
    734734   * \param name     The name of the attribute 
     
    747747   * to the template version of this method). 
    748748   * 
    749    * \exception tXML2WrapperException is thrown if the requested attribute does not exist and should not be created 
     749   * \exception tException is thrown if the requested attribute does not exist and should not be created 
    750750   * 
    751751   * \param name     The name of the attribute 
     
    783783    if (errno || *endptr) 
    784784    { 
    785       throw tXML2WrapperException("Could not convert `" + value + "' to number!"); 
     785      throw tException("Could not convert `" + value + "' to number!"); 
    786786    } 
    787787    return result; 
     
    796796    if (errno || *endptr) 
    797797    { 
    798       throw tXML2WrapperException("Could not convert `" + value + "' to number!"); 
     798      throw tException("Could not convert `" + value + "' to number!"); 
    799799    } 
    800800    return result; 
  • test/test.cpp

    r38 r42  
    2020// 
    2121//---------------------------------------------------------------------- 
    22 /*!\file    test_xml2_wrapper.cpp 
     22/*!\file    test.cpp 
    2323 * 
    2424 * \author  Tobias Foehst 
     
    3838// Internal includes with "" 
    3939//---------------------------------------------------------------------- 
    40 #include "rrlib/xml2_wrapper/tXMLDocument.h" 
     40#include "rrlib/xml/tDocument.h" 
    4141 
    4242//---------------------------------------------------------------------- 
     
    4848// Namespace usage 
    4949//---------------------------------------------------------------------- 
    50 using namespace rrlib::xml2; 
     50using namespace rrlib::xml; 
    5151 
    5252//---------------------------------------------------------------------- 
     
    6464int main(int argc, char **argv) 
    6565{ 
    66   tXMLDocument document1; 
    67   tXMLNode &root_node = document1.AddRootNode("test"); 
     66  tDocument document1; 
     67  tNode &root_node = document1.AddRootNode("test"); 
    6868  root_node.SetAttribute("prop_1", "val"); 
    6969  root_node.SetAttribute("prop_2", true); 
    7070  root_node.SetAttribute("prop_3", 4.3); 
    7171  root_node.SetAttribute("prop_4", 123); 
    72   tXMLNode &node1 = root_node.AddChildNode("test1"); 
     72  tNode &node1 = root_node.AddChildNode("test1"); 
    7373  node1.SetAttribute("prop_1", "val_1"); 
    7474  node1.SetAttribute("prop_2", true); 
     
    8383////  node1.RemoveTextContent(); 
    8484 
    85   tXMLNode &node2 = node1.AddChildNode("test2"); 
     85  tNode &node2 = node1.AddChildNode("test2"); 
    8686  node2.SetAttribute("prop_1", "val_2"); 
    8787  node2.SetAttribute("prop_2", true); 
     
    101101  std::cout << document1.RootNode().GetIntAttribute("prop_4") << std::endl; 
    102102 
    103   for (tXMLNode::iterator it = document1.RootNode().ChildrenBegin(); it != document1.RootNode().ChildrenEnd(); ++it) 
     103  for (tNode::iterator it = document1.RootNode().ChildrenBegin(); it != document1.RootNode().ChildrenEnd(); ++it) 
    104104  { 
    105105    std::cout << "Accessing node with content: " << it->GetXMLDump() << std::endl; 
     
    117117  document1.WriteToFile("test.xml"); 
    118118 
    119   tXMLDocument document2(std::string("test.xml"), false); 
     119  tDocument document2(std::string("test.xml"), false); 
    120120 
    121121  std::cout << "doc 2" << std::endl; 
     
    134134  std::cout << "Accessing node with content: " << document2.RootNode().GetXMLDump(true) << std::endl; 
    135135 
    136   for (tXMLNode::iterator it = document2.RootNode().ChildrenBegin(); it != document2.RootNode().ChildrenEnd(); ++it) 
     136  for (tNode::iterator it = document2.RootNode().ChildrenBegin(); it != document2.RootNode().ChildrenEnd(); ++it) 
    137137  { 
    138138    std::cout << "Accessing node with content: " << it->GetXMLDump() << std::endl; 
     
    152152 
    153153  { 
    154     tXMLDocument document3; 
     154    tDocument document3; 
    155155 
    156156    document3.AddRootNode("foo"); 
     
    169169    std::cout << "content = " << document3.RootNode().FirstChild().GetTextContent() << std::endl; 
    170170 
    171     for (tXMLNode::iterator it = document3.RootNode().FirstChild().ChildrenBegin(); it != document3.RootNode().FirstChild().ChildrenEnd(); ++it) 
     171    for (tNode::iterator it = document3.RootNode().FirstChild().ChildrenBegin(); it != document3.RootNode().FirstChild().ChildrenEnd(); ++it) 
    172172    { 
    173173      std::cout << "child: " << it->GetXMLDump() << std::endl; 
Note: See TracChangeset for help on using the changeset viewer.