![]() |
XmlNode Class Reference#include <XmlNode.h>
Detailed DescriptionDefinition at line 51 of file XmlNode.h. Constructor & Destructor Documentation
Definition at line 45 of file XmlNode.cpp. 00046 : m_doc(doc) 00047 , m_current( GetRootElement() ) 00048 { 00049 }
Definition at line 52 of file XmlNode.cpp. References GetFirstElement(), and SetCurrent(). 00053 : m_doc(doc) 00054 , m_current( GetRootElement() ) 00055 { 00056 xmlNodePtr p = GetFirstElement( nodepath ); 00057 SetCurrent( p ); 00058 }
Definition at line 61 of file XmlNode.cpp. References GetFirstElement(), and SetCurrent(). 00062 : m_doc( node.GetDocument() ) 00063 , m_current( node ) 00064 { 00065 xmlNodePtr p = GetFirstElement( node, nodepath ); 00066 SetCurrent( p ); 00067 }
Member Function Documentation
Definition at line 257 of file XmlNode.cpp. References m_current. 00258 { 00259 return m_current; 00260 }
Definition at line 263 of file XmlNode.cpp. References GetFirstElement(), m_current, m_doc, SetCurrent(), and XmlNode(). 00264 { 00265 xmlNodePtr p0 = m_current; 00266 xmlNodePtr p = GetFirstElement( m_current, name ); 00267 SetCurrent( p0 ); 00268 if (p) 00269 return XmlNode( m_doc, p ); 00270 throw XmlException("Didn't find node: " + name); 00271 }
Definition at line 285 of file XmlNode.cpp. References GetNextNode(), GetNodeName(), m_current, and m_lookup_name. 00286 { 00287 GetNextNode(); 00288 while (m_current) 00289 { 00290 if (m_lookup_name == GetNodeName()) 00291 { 00292 return; 00293 } 00294 GetNextNode(); 00295 } 00296 }
Assign document root element to 'current node'.
Definition at line 89 of file XmlNode.cpp. References m_current, and m_doc. Referenced by GetFirstElement().
Return property 'propname' for 'current node'.
Definition at line 96 of file XmlNode.cpp. References Utility::FromUtf8(), GetNodeName(), and m_current. Referenced by FindProperty(). 00097 { 00098 xmlChar *p = m_current ? xmlGetProp(m_current, (const xmlChar *) name.c_str() ) : NULL; 00099 if (!p) 00100 { 00101 throw XmlException( "Property '" + name + "' not found in node: " + GetNodeName() ); 00102 } 00103 std::string str = (char *)p; 00104 xmlFree(p); 00105 return Utility::FromUtf8(str); 00106 }
Definition at line 109 of file XmlNode.cpp. References m_current. Referenced by FindProperty(). 00110 { 00111 xmlChar *p = m_current ? xmlGetProp(m_current, (const xmlChar *) name.c_str() ) : NULL; 00112 if (!p) 00113 { 00114 return false; 00115 } 00116 xmlFree(p); 00117 return true; 00118 }
Assign first child node of 'current node' to 'current node'.
Definition at line 121 of file XmlNode.cpp. References m_current. Referenced by GetContent(), and GetFirstElement(). 00122 { 00123 m_current = m_current ? m_current -> xmlChildrenNode : NULL; 00124 return m_current; 00125 }
Assign next non-blank (xmlIsBlankNode) node of 'current node' to 'current node'.
Definition at line 128 of file XmlNode.cpp. References m_current. Referenced by GetFirstElement(), GetNextElement(), and operator++(). 00129 { 00130 do 00131 { 00132 m_current = m_current ? m_current -> next : NULL; 00133 } while (m_current && xmlIsBlankNode( m_current )); 00134 return m_current; 00135 }
Return nodename of 'current node'.
Definition at line 138 of file XmlNode.cpp. References Utility::FromUtf8(), m_current, and m_current_name. Referenced by GetFirstElement(), GetNextElement(), GetProperty(), and operator++(). 00139 { 00140 if (m_current) 00141 { 00142 m_current_name = Utility::FromUtf8((char *)m_current -> name); 00143 } 00144 else 00145 { 00146 m_current_name = ""; 00147 } 00148 return m_current_name; 00149 }
Return content of 'current node'.
Definition at line 152 of file XmlNode.cpp. References Utility::FromUtf8(), GetChildrenNode(), m_content, m_current, and SetCurrent(). Referenced by operator std::string(). 00153 { 00154 m_content = ""; 00155 if (m_current) 00156 { 00157 xmlNodePtr p = m_current; 00158 xmlNodePtr p2 = GetChildrenNode(); 00159 if (p2 && p2 -> content) 00160 { 00161 m_content = Utility::FromUtf8((char *)p2 -> content); 00162 } 00163 SetCurrent(p); 00164 } 00165 return m_content; 00166 }
Sets 'current node' that the following methods act on: GetProperty GetNodeName GetContent GetNodeNs GetNodeNsPrefix GetNodeNsHref.
Definition at line 100 of file XmlNode.h. References m_current. Referenced by Exists(), GetContent(), GetFirstElement(), GetNextElement(), operator[](), and XmlNode(). 00100 { m_current = p; }
Definition at line 169 of file XmlNode.cpp. References m_current.
Definition at line 177 of file XmlNode.cpp. References Utility::FromUtf8(), m_current, and m_ns_prefix. 00178 { 00179 if (m_current && m_current -> ns && m_current -> ns -> prefix) 00180 { 00181 m_ns_prefix = Utility::FromUtf8((char *)m_current -> ns -> prefix); 00182 } 00183 else 00184 { 00185 m_ns_prefix = ""; 00186 } 00187 return m_ns_prefix; 00188 }
Definition at line 191 of file XmlNode.cpp. References Utility::FromUtf8(), m_current, and m_ns_href. 00192 { 00193 if (m_current && m_current -> ns && m_current -> ns -> href) 00194 { 00195 m_ns_href = Utility::FromUtf8((char *)m_current -> ns -> href); 00196 } 00197 else 00198 { 00199 m_ns_href = ""; 00200 } 00201 return m_ns_href; 00202 }
Search element named 'name' in Root element child nodes. Set 'current node' to Root element. Definition at line 205 of file XmlNode.cpp. References GetChildrenNode(), GetNextNode(), GetNodeName(), GetRootElement(), and m_lookup_name. Referenced by Exists(), operator[](), and XmlNode(). 00206 { 00207 if (m_lookup_name.empty()) 00208 m_lookup_name = name; 00209 GetRootElement(); 00210 xmlNodePtr p = GetChildrenNode(); 00211 while (p) 00212 { 00213 if (name == GetNodeName()) 00214 { 00215 return p; 00216 } 00217 p = GetNextNode(); 00218 } 00219 return NULL; 00220 }
Search element named 'name' in 'parent' element child nodes. Set 'current node' to 'parent'. Definition at line 223 of file XmlNode.cpp. References GetChildrenNode(), GetNextNode(), GetNodeName(), m_lookup_name, and SetCurrent(). 00224 { 00225 if (m_lookup_name.empty()) 00226 m_lookup_name = name; 00227 SetCurrent(base); 00228 xmlNodePtr p = GetChildrenNode(); 00229 while (p) 00230 { 00231 if (name == GetNodeName()) 00232 { 00233 return p; 00234 } 00235 p = GetNextNode(); 00236 } 00237 return NULL; 00238 }
Find next element named 'name' on same level as 'node'. Set 'current node' to 'p'. Definition at line 241 of file XmlNode.cpp. References GetNextNode(), GetNodeName(), and SetCurrent(). 00242 { 00243 SetCurrent(p); 00244 p = GetNextNode(); 00245 while (p) 00246 { 00247 if (name == GetNodeName()) 00248 { 00249 return p; 00250 } 00251 p = GetNextNode(); 00252 } 00253 return NULL; 00254 }
Check that child element with name 'name' exists.
Definition at line 274 of file XmlNode.cpp. References GetFirstElement(), m_current, and SetCurrent(). 00275 { 00276 xmlNodePtr p0 = m_current; 00277 xmlNodePtr p = GetFirstElement( m_current, name ); 00278 SetCurrent( p0 ); 00279 if (p) 00280 return true; 00281 return false; 00282 }
[prefix] = href
Definition at line 299 of file XmlNode.cpp. References Utility::FromUtf8(), m_current, and m_doc. 00300 { 00301 xmlNsPtr *p = xmlGetNsList(m_doc, m_current); 00302 std::map<std::string, std::string> vec; 00303 int i = 0; 00304 while (p[i]) 00305 { 00306 std::string href = Utility::FromUtf8((char *)p[i] -> href); 00307 std::string prefix = p[i] -> prefix ? Utility::FromUtf8((char *)p[i] -> prefix) : ""; 00308 vec[prefix] = href; 00309 ++i; 00310 } 00311 return vec; 00312 }
[href] = prefix
Definition at line 315 of file XmlNode.cpp. References Utility::FromUtf8(), m_current, and m_doc. 00316 { 00317 xmlNsPtr *p = xmlGetNsList(m_doc, m_current); 00318 std::map<std::string, std::string> vec; 00319 int i = 0; 00320 while (p[i]) 00321 { 00322 std::string href = Utility::FromUtf8((char *)p[i] -> href); 00323 std::string prefix = p[i] -> prefix ? Utility::FromUtf8((char *)p[i] -> prefix) : ""; 00324 vec[href] = prefix; 00325 if (!p[i] -> next) 00326 break; 00327 ++i; 00328 } 00329 return vec; 00330 }
Definition at line 333 of file XmlNode.cpp. References GetProperty(), m_current, and PropertyExists(). 00334 { 00335 while (m_current) 00336 { 00337 if (PropertyExists(propname)) 00338 { 00339 return GetProperty(propname); 00340 } 00341 if (!climb) 00342 { 00343 break; 00344 } 00345 m_current = m_current -> parent; 00346 } 00347 return ""; 00348 }
Member Data Documentation
Definition at line 133 of file XmlNode.h. Referenced by GetDocument(), GetNsMap(), GetNsMapRe(), GetRootElement(), and operator[]().
Definition at line 134 of file XmlNode.h. Referenced by Exists(), FindProperty(), GetChildrenNode(), GetContent(), GetNextNode(), GetNodeName(), GetNodeNs(), GetNodeNsHref(), GetNodeNsPrefix(), GetNsMap(), GetNsMapRe(), GetProperty(), GetRootElement(), operator xmlNodePtr(), operator++(), operator[](), PropertyExists(), SetCurrent(), and Valid().
The documentation for this class was generated from the following files: |