class XMLNode

An XML Tag represented as a single class.

Public Methods

[more]map<string,string> & properties()
Return all properties
[more]const map<string,string> & const_properties() const
Return all properties (read only)
[more]string property(const string &name)
Return a single property
[more]int intProperty(const string &name)
Return property as an integer if possible, otherwise 0
[more]bool hasChild(const string &name, int n=1)
true if the node has a child with the specified name
[more]int numChildren(const string &name)
Return how many children of a specified name there is in the node
[more]vector<XMLNode> & children()
Return all children
[more]const vector<XMLNode> & const_children() const
Return all children (read only)
[more]XMLNode& child(const string &name, int n=1)
Return a single child
[more]XMLNode& setName(const string &name)
Set tag name
[more]XMLNode& setData(const string &data)
Set data
[more]XMLNode& setCData(const string &data)
Set data as cdata sections
[more]XMLNode& setProperty(const string &name, int value)
[more]XMLNode& addChild( XMLNode &node)
Add a child node to the tree
[more]XMLNode& addChild(const string &name, const string &data="")
- " -
[more]XMLNode& delChild(const string &name, int n=1)
Delete a child node
[more]XMLNode& operator<<(const string &str)
Parse a string into a XMLNode directly
[more] operator string() const
Implicitly convert to string
[more]string& operator[](const string &name)
Set and get tag properties using operator[]
[more]const string operator[](const string &name) const
- " -


Documentation

An XML Tag represented as a single class.

This is a parsed xml tag. It stores all properties and all nested nodes and the text between the start tag. It can be used as a combined tree, array and associative map data structure without any artificial size limits.

Terminology:

Example:
  <tag property1="value" property2="a value">
  .. some text here ..
  </tag>
  

omap<string,string> & properties()
Return all properties

oconst map<string,string> & const_properties() const
Return all properties (read only)

ostring property(const string &name)
Return a single property

oint intProperty(const string &name)
Return property as an integer if possible, otherwise 0

obool hasChild(const string &name, int n=1)
true if the node has a child with the specified name
Parameters:
name - name of tag to look for
n - how many tags are required (n=2 means there has to be two children with the specified name)

oint numChildren(const string &name)
Return how many children of a specified name there is in the node

ovector<XMLNode> & children()
Return all children

oconst vector<XMLNode> & const_children() const
Return all children (read only)

oXMLNode& child(const string &name, int n=1)
Return a single child
Parameters:
name - name of tag to look for
n - which tag to return if there are more than one

oXMLNode& setName(const string &name)
Set tag name

oXMLNode& setData(const string &data)
Set data

oXMLNode& setCData(const string &data)
Set data as cdata sections

oXMLNode& setProperty(const string &name, int value)

oXMLNode& addChild( XMLNode &node)
Add a child node to the tree

oXMLNode& addChild(const string &name, const string &data="")
- " -

oXMLNode& delChild(const string &name, int n=1)
Delete a child node
Parameters:
name - name of tag to look for
n - which tag to delete if there are more than one

oXMLNode& operator<<(const string &str)
Parse a string into a XMLNode directly

o operator string() const
Implicitly convert to string

ostring& operator[](const string &name)
Set and get tag properties using operator[]

oconst string operator[](const string &name) const
- " -


This class has no child classes.
Friends:
ostream& operator<<(ostream &o,XMLNode &n)
class XMLParser
Author:
Henrik Abelsson
Version:
0.1

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.