IN2OSM
1.0.1
|
#include <rapidxml.hpp>
Classes | |
struct | attribute_name_pred |
struct | attribute_value_pred |
struct | attribute_value_pure_pred |
struct | node_name_pred |
struct | text_pred |
struct | text_pure_no_ws_pred |
struct | text_pure_with_ws_pred |
struct | whitespace_pred |
Public Member Functions | |
xml_document () | |
Constructs empty XML document. More... | |
template<int Flags> | |
void | parse (Ch *text) |
void | clear () |
node_type | type () const |
void | type (node_type type) |
xml_document< Ch > * | document () const |
xml_node< Ch > * | first_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
xml_node< Ch > * | last_node (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
xml_node< Ch > * | previous_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
xml_node< Ch > * | next_sibling (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
xml_attribute< Ch > * | first_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
xml_attribute< Ch > * | last_attribute (const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const |
void | prepend_node (xml_node< Ch > *child) |
void | append_node (xml_node< Ch > *child) |
void | insert_node (xml_node< Ch > *where, xml_node< Ch > *child) |
void | remove_first_node () |
void | remove_last_node () |
void | remove_node (xml_node< Ch > *where) |
Removes specified child from the node. More... | |
void | remove_all_nodes () |
Removes all child nodes (but not attributes). More... | |
void | prepend_attribute (xml_attribute< Ch > *attribute) |
void | append_attribute (xml_attribute< Ch > *attribute) |
void | insert_attribute (xml_attribute< Ch > *where, xml_attribute< Ch > *attribute) |
void | remove_first_attribute () |
void | remove_last_attribute () |
void | remove_attribute (xml_attribute< Ch > *where) |
void | remove_all_attributes () |
Removes all attributes of node. More... | |
Ch * | name () const |
void | name (const Ch *name, std::size_t size) |
void | name (const Ch *name) |
std::size_t | name_size () const |
Ch * | value () const |
void | value (const Ch *value, std::size_t size) |
void | value (const Ch *value) |
std::size_t | value_size () const |
xml_node< Ch > * | parent () const |
xml_node< Ch > * | allocate_node (node_type type, const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0) |
xml_attribute< Ch > * | allocate_attribute (const Ch *name=0, const Ch *value=0, std::size_t name_size=0, std::size_t value_size=0) |
Ch * | allocate_string (const Ch *source=0, std::size_t size=0) |
xml_node< Ch > * | clone_node (const xml_node< Ch > *source, xml_node< Ch > *result=0) |
void | set_allocator (alloc_func *af, free_func *ff) |
Static Protected Member Functions | |
static Ch * | nullstr () |
Protected Attributes | |
Ch * | m_name |
Ch * | m_value |
std::size_t | m_name_size |
std::size_t | m_value_size |
xml_node< Ch > * | m_parent |
Private Member Functions | |
template<int Flags> | |
void | parse_bom (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_xml_declaration (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_comment (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_doctype (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_pi (Ch *&text) |
template<int Flags> | |
Ch | parse_and_append_data (xml_node< Ch > *node, Ch *&text, Ch *contents_start) |
template<int Flags> | |
xml_node< Ch > * | parse_cdata (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_element (Ch *&text) |
template<int Flags> | |
xml_node< Ch > * | parse_node (Ch *&text) |
template<int Flags> | |
void | parse_node_contents (Ch *&text, xml_node< Ch > *node) |
template<int Flags> | |
void | parse_node_attributes (Ch *&text, xml_node< Ch > *node) |
Static Private Member Functions | |
template<int Flags> | |
static void | insert_coded_character (Ch *&text, unsigned long code) |
template<class StopPred , int Flags> | |
static void | skip (Ch *&text) |
template<class StopPred , class StopPredPure , int Flags> | |
static Ch * | skip_and_expand_character_refs (Ch *&text) |
This class represents root of the DOM hierarchy. It is also an xml_node and a memory_pool through public inheritance. Use parse() function to build a DOM tree from a zero-terminated XML text string. parse() function allocates memory for nodes and attributes by using functions of xml_document, which are inherited from memory_pool. To access root node of the document, use the document itself, as if it was an xml_node.
Ch | Character type to use. |
Definition at line 139 of file rapidxml.hpp.
|
inline |
|
inlineinherited |
Allocates a new attribute from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc
. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.
name | Name to assign to the attribute, or 0 to assign no name. |
value | Value to assign to the attribute, or 0 to assign no value. |
name_size | Size of name to assign, or 0 to automatically calculate size from name string. |
value_size | Size of value to assign, or 0 to automatically calculate size from value string. |
Definition at line 447 of file rapidxml.hpp.
|
inlineinherited |
Allocates a new node from the pool, and optionally assigns name and value to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc
. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.
type | Type of node to create. |
name | Name to assign to the node, or 0 to assign no name. |
value | Value to assign to the node, or 0 to assign no value. |
name_size | Size of name to assign, or 0 to automatically calculate size from name string. |
value_size | Size of value to assign, or 0 to automatically calculate size from value string. |
Definition at line 415 of file rapidxml.hpp.
|
inlineinherited |
Allocates a char array of given size from the pool, and optionally copies a given string to it. If the allocation request cannot be accomodated, this function will throw std::bad_alloc
. If exceptions are disabled by defining RAPIDXML_NO_EXCEPTIONS, this function will call rapidxml::parse_error_handler() function.
source | String to initialize the allocated memory with, or 0 to not initialize it. |
size | Number of characters to allocate, or zero to calculate it automatically from source string length; if size is 0, source string must be specified and null terminated. |
Definition at line 476 of file rapidxml.hpp.
|
inlineinherited |
Appends a new attribute to the node.
attribute | Attribute to append. |
Definition at line 1217 of file rapidxml.hpp.
|
inlineinherited |
Appends a new child node. The appended child becomes the last child.
child | Node to append. |
Definition at line 1097 of file rapidxml.hpp.
|
inline |
Clears the document by deleting all nodes and clearing the memory pool. All nodes owned by document pool are destroyed.
Definition at line 1415 of file rapidxml.hpp.
|
inlineinherited |
Clones an xml_node and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document.
source | Node to clone. |
result | Node to put results in, or 0 to automatically allocate result node |
Definition at line 497 of file rapidxml.hpp.
|
inlineinherited |
Gets document of which node is a child.
Definition at line 923 of file rapidxml.hpp.
|
inlineinherited |
Gets first attribute of node, optionally matching attribute name.
name | Name of attribute to find, or 0 to return first attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 1025 of file rapidxml.hpp.
|
inlineinherited |
Gets first child node, optionally matching node name.
name | Name of child to find, or 0 to return first child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 936 of file rapidxml.hpp.
|
inlineinherited |
Inserts a new attribute at specified place inside the node. All attributes after and including the specified attribute are moved one position back.
where | Place where to insert the attribute, or 0 to insert at the back. |
attribute | Attribute to insert. |
Definition at line 1239 of file rapidxml.hpp.
|
inlinestaticprivate |
Definition at line 1511 of file rapidxml.hpp.
Inserts a new child node at specified place inside the node. All children after and including the specified node are moved one position back.
where | Place where to insert the child, or 0 to insert at the back. |
child | Node to insert. |
Definition at line 1119 of file rapidxml.hpp.
|
inlineinherited |
Gets last attribute of node, optionally matching attribute name.
name | Name of attribute to find, or 0 to return last attribute regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 1045 of file rapidxml.hpp.
|
inlineinherited |
Gets last child node, optionally matching node name. Behaviour is undefined if node has no children. Use first_node() to test if node has children.
name | Name of child to find, or 0 to return last child regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 958 of file rapidxml.hpp.
|
inlineinherited |
Gets name of the node. Interpretation of name depends on type of node. Note that name will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
Use name_size() function to determine length of the name.
Definition at line 673 of file rapidxml.hpp.
|
inlineinherited |
Sets name of node to a non zero-terminated string. See ownership_of_strings.
Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.
Size of name must be specified separately, because name does not have to be zero terminated. Use name(const Ch *) function to have the length automatically calculated (string must be zero terminated).
name | Name of node to set. Does not have to be zero terminated. |
size | Size of name, in characters. This does not include zero terminator, if one is present. |
Definition at line 721 of file rapidxml.hpp.
|
inlineinherited |
Sets name of node to a zero-terminated string. See also ownership_of_strings and xml_node::name(const Ch *, std::size_t).
name | Name of node to set. Must be zero terminated. |
Definition at line 730 of file rapidxml.hpp.
|
inlineinherited |
Gets size of node name, not including terminator character. This function works correctly irrespective of whether name is or is not zero terminated.
Definition at line 681 of file rapidxml.hpp.
|
inlineinherited |
Gets next sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.
name | Name of sibling to find, or 0 to return next sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 1004 of file rapidxml.hpp.
|
inlinestaticprotectedinherited |
Definition at line 778 of file rapidxml.hpp.
|
inlineinherited |
Gets node parent.
Definition at line 770 of file rapidxml.hpp.
|
inline |
Parses zero-terminated XML string according to given flags. Passed string will be modified by the parser, unless rapidxml::parse_non_destructive flag is used. The string must persist for the lifetime of the document. In case of error, rapidxml::parse_error exception will be thrown.
If you want to parse contents of a file, you must first load the file into the memory, and pass pointer to its beginning. Make sure that data is zero-terminated.
Document can be parsed into multiple times. Each new call to parse removes previous nodes and attributes (if any), but does not clear memory pool.
text | XML data to parse; pointer is non-const to denote fact that this data may be modified by the parser. |
Definition at line 1381 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1940 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1725 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1998 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1773 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1814 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 2037 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 2081 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 2237 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 2167 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1880 of file rapidxml.hpp.
|
inlineprivate |
Definition at line 1738 of file rapidxml.hpp.
|
inlineinherited |
Prepends a new attribute to the node.
attribute | Attribute to prepend. |
Definition at line 1197 of file rapidxml.hpp.
|
inlineinherited |
Prepends a new child node. The prepended child becomes the first child, and all existing children are moved one position back.
child | Node to prepend. |
Definition at line 1076 of file rapidxml.hpp.
|
inlineinherited |
Gets previous sibling node, optionally matching node name. Behaviour is undefined if node has no parent. Use parent() to test if node has a parent.
name | Name of sibling to find, or 0 to return previous sibling regardless of its name; this string doesn't have to be zero-terminated if name_size is non-zero |
name_size | Size of name, in characters, or 0 to have size calculated automatically from string |
case_sensitive | Should name comparison be case-sensitive; non case-sensitive comparison works properly only for ASCII characters |
Definition at line 981 of file rapidxml.hpp.
|
inlineinherited |
Removes all attributes of node.
Definition at line 1309 of file rapidxml.hpp.
|
inlineinherited |
Removes all child nodes (but not attributes).
Definition at line 1188 of file rapidxml.hpp.
|
inlineinherited |
Removes specified attribute from node.
where | Pointer to attribute to be removed. |
Definition at line 1293 of file rapidxml.hpp.
|
inlineinherited |
Removes first attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.
Definition at line 1260 of file rapidxml.hpp.
|
inlineinherited |
Removes first child node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.
Definition at line 1140 of file rapidxml.hpp.
|
inlineinherited |
Removes last attribute of the node. If node has no attributes, behaviour is undefined. Use first_attribute() to test if node has attributes.
Definition at line 1277 of file rapidxml.hpp.
|
inlineinherited |
Removes last child of the node. If node has no children, behaviour is undefined. Use first_node() to test if node has children.
Definition at line 1155 of file rapidxml.hpp.
|
inlineinherited |
Removes specified child from the node.
Definition at line 1171 of file rapidxml.hpp.
|
inlineinherited |
Sets or resets the user-defined memory allocation functions for the pool. This can only be called when no memory is allocated from the pool yet, otherwise results are undefined. Allocation function must not return invalid pointer on failure. It should either throw, stop the program, or use longjmp()
function to pass control to other place of program. If it returns invalid pointer, results are undefined.
User defined allocation functions must have the following forms:
void *allocate(std::size_t size);
void free(void *pointer);
af | Allocation function, or 0 to restore default function |
ff | Free function, or 0 to restore default function |
Definition at line 552 of file rapidxml.hpp.
|
inlinestaticprivate |
Definition at line 1558 of file rapidxml.hpp.
|
inlinestaticprivate |
Definition at line 1570 of file rapidxml.hpp.
|
inlineinherited |
Gets type of node.
Definition at line 913 of file rapidxml.hpp.
|
inlineinherited |
Sets type of node.
type | Type of node to set. |
Definition at line 1065 of file rapidxml.hpp.
|
inlineinherited |
Gets value of node. Interpretation of value depends on type of node. Note that value will not be zero-terminated if rapidxml::parse_no_string_terminators option was selected during parse.
Use value_size() function to determine length of the value.
Definition at line 692 of file rapidxml.hpp.
|
inlineinherited |
Sets value of node to a non zero-terminated string. See ownership_of_strings.
Note that node does not own its name or value, it only stores a pointer to it. It will not delete or otherwise free the pointer on destruction. It is reponsibility of the user to properly manage lifetime of the string. The easiest way to achieve it is to use memory_pool of the document to allocate the string - on destruction of the document the string will be automatically freed.
Size of value must be specified separately, because it does not have to be zero terminated. Use value(const Ch *) function to have the length automatically calculated (string must be zero terminated).
If an element has a child node of type node_data, it will take precedence over element value when printing. If you want to manipulate data of elements using values, use parser flag rapidxml::parse_no_data_nodes to prevent creation of data nodes by the parser.
value | value of node to set. Does not have to be zero terminated. |
size | Size of value, in characters. This does not include zero terminator, if one is present. |
Definition at line 751 of file rapidxml.hpp.
|
inlineinherited |
Sets value of node to a zero-terminated string. See also ownership_of_strings and xml_node::value(const Ch *, std::size_t).
value | Vame of node to set. Must be zero terminated. |
Definition at line 760 of file rapidxml.hpp.
|
inlineinherited |
Gets size of node value, not including terminator character. This function works correctly irrespective of whether value is or is not zero terminated.
Definition at line 700 of file rapidxml.hpp.
|
protectedinherited |
Definition at line 784 of file rapidxml.hpp.
|
protectedinherited |
Definition at line 786 of file rapidxml.hpp.
|
protectedinherited |
Definition at line 788 of file rapidxml.hpp.
|
protectedinherited |
Definition at line 785 of file rapidxml.hpp.
|
protectedinherited |
Definition at line 787 of file rapidxml.hpp.