cphot 0.1
A C++ tool for computing photometry from spectra.
rapidxml Namespace Reference

Classes

class  attribute_iterator
 Iterator of child attributes of xml_node. More...
 
class  eof_error
 
class  file
 Represents data loaded from a file. More...
 
class  memory_pool
 This class is used by the parser to create new nodes and attributes, without overheads of dynamic memory allocation. More...
 
class  node_iterator
 Iterator of child nodes of xml_node. More...
 
class  parse_error
 Parse error exception. More...
 
class  validation_error
 
class  xml_attribute
 Class representing attribute node of XML document. More...
 
class  xml_base
 Base class for xml_node and xml_attribute implementing common functions: name(), name_size(), value(), value_size() and parent(). More...
 
class  xml_document
 This class represents root of the DOM hierarchy. More...
 
class  xml_node
 Class representing a node of XML document. More...
 

Enumerations

enum  node_type {
  node_document, node_element, node_data, node_cdata,
  node_comment, node_declaration, node_doctype, node_pi
}
 Enumeration listing all node types produced by the parser. More...
 

Functions

template<class OutIt , class Ch >
OutIt print (OutIt out, const xml_node< Ch > &node, int flags=0)
 Prints XML to given output iterator. More...
 
template<class Ch >
std::basic_ostream< Ch > & print (std::basic_ostream< Ch > &out, const xml_node< Ch > &node, int flags=0)
 Prints XML to given output stream. More...
 
template<class Ch >
std::basic_ostream< Ch > & operator<< (std::basic_ostream< Ch > &out, const xml_node< Ch > &node)
 Prints formatted XML to given output stream. More...
 
template<class Ch >
std::size_t count_children (xml_node< Ch > *node)
 Counts children of node. More...
 
template<class Ch >
std::size_t count_attributes (xml_node< Ch > *node)
 Counts attributes of node. More...
 

Variables

const int parse_no_data_nodes = 0x1
 Parse flag instructing the parser to not create data nodes. More...
 
const int parse_no_element_values = 0x2
 Parse flag instructing the parser to not use text of first data node as a value of parent element. More...
 
const int parse_no_string_terminators = 0x4
 Parse flag instructing the parser to not place zero terminators after strings in the source text. More...
 
const int parse_no_entity_translation = 0x8
 Parse flag instructing the parser to not translate entities in the source text. More...
 
const int parse_no_utf8 = 0x10
 Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters. More...
 
const int parse_declaration_node = 0x20
 Parse flag instructing the parser to create XML declaration node. More...
 
const int parse_comment_nodes = 0x40
 Parse flag instructing the parser to create comments nodes. More...
 
const int parse_doctype_node = 0x80
 Parse flag instructing the parser to create DOCTYPE node. More...
 
const int parse_pi_nodes = 0x100
 Parse flag instructing the parser to create PI nodes. More...
 
const int parse_validate_closing_tags = 0x200
 Parse flag instructing the parser to validate closing tag names. More...
 
const int parse_trim_whitespace = 0x400
 Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes. More...
 
const int parse_normalize_whitespace = 0x800
 Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character. More...
 
const int parse_open_only = 0x1000
 Parse flag to say "Parse only the initial element opening." Useful for XMLstreams used in XMPP. More...
 
const int parse_parse_one = 0x2000
 Parse flag to say "Toss the children of the top node and parse off one element. More...
 
const int parse_validate_xmlns = 0x4000
 Parse flag to say "Validate XML namespaces fully." This will generate additional errors, including unbound prefixes and duplicate attributes (with different prefices) More...
 
const int parse_default = 0
 Parse flags which represent default behaviour of the parser. More...
 
const int parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation
 A combination of parse flags that forbids any modifications of the source text. More...
 
const int parse_fastest = parse_non_destructive | parse_no_data_nodes
 A combination of parse flags resulting in fastest possible parsing, without sacrificing important data. More...
 
const int parse_full = parse_declaration_node | parse_comment_nodes | parse_doctype_node | parse_pi_nodes | parse_validate_closing_tags
 A combination of parse flags resulting in largest amount of data being extracted. More...
 
const int print_no_indenting = 0x1
 Printer flag instructing the printer to suppress indenting of XML. More...
 

Enumeration Type Documentation

◆ node_type

Enumeration listing all node types produced by the parser.

Use xml_node::type() function to query node type.

Enumerator
node_document 

A document node.

Name and value are empty.

node_element 

An element node.

Name contains element name. Value contains text of first data node.

node_data 

A data node.

Name is empty. Value contains data text.

node_cdata 

A CDATA node.

Name is empty. Value contains data text.

node_comment 

A comment node.

Name is empty. Value contains comment text.

node_declaration 

A declaration node.

Name and value are empty. Declaration parameters (version, encoding and standalone) are in node attributes.

node_doctype 

A DOCTYPE node.

Name is empty. Value contains DOCTYPE text.

node_pi 

A PI node.

Name contains target. Value contains instructions.

Definition at line 146 of file rapidxml.hpp.

Function Documentation

◆ count_attributes()

template<class Ch >
std::size_t rapidxml::count_attributes ( xml_node< Ch > *  node)
inline

Counts attributes of node.

Time complexity is O(n).

Returns
Number of attributes of node

Definition at line 108 of file rapidxml_utils.hpp.

◆ count_children()

template<class Ch >
std::size_t rapidxml::count_children ( xml_node< Ch > *  node)
inline

Counts children of node.

Time complexity is O(n).

Returns
Number of children of node

Definition at line 93 of file rapidxml_utils.hpp.

◆ operator<<()

template<class Ch >
std::basic_ostream<Ch>& rapidxml::operator<< ( std::basic_ostream< Ch > &  out,
const xml_node< Ch > &  node 
)
inline

Prints formatted XML to given output stream.

Uses default printing flags. Use print() function to customize printing process.

Parameters
outOutput stream to print to.
nodeNode to be printed.
Returns
Output stream.

Definition at line 416 of file rapidxml_print.hpp.

◆ print() [1/2]

template<class OutIt , class Ch >
OutIt rapidxml::print ( OutIt  out,
const xml_node< Ch > &  node,
int  flags = 0 
)
inline

Prints XML to given output iterator.

Parameters
outOutput iterator to print to.
nodeNode to be printed. Pass xml_document to print entire document.
flagsFlags controlling how XML is printed.
Returns
Output iterator pointing to position immediately after last character of printed text.

Definition at line 392 of file rapidxml_print.hpp.

◆ print() [2/2]

template<class Ch >
std::basic_ostream<Ch>& rapidxml::print ( std::basic_ostream< Ch > &  out,
const xml_node< Ch > &  node,
int  flags = 0 
)
inline

Prints XML to given output stream.

Parameters
outOutput stream to print to.
nodeNode to be printed. Pass xml_document to print entire document.
flagsFlags controlling how XML is printed.
Returns
Output stream.

Definition at line 405 of file rapidxml_print.hpp.

Variable Documentation

◆ parse_comment_nodes

const int rapidxml::parse_comment_nodes = 0x40

Parse flag instructing the parser to create comments nodes.

By default, comment nodes are not created. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 210 of file rapidxml.hpp.

◆ parse_declaration_node

const int rapidxml::parse_declaration_node = 0x20

Parse flag instructing the parser to create XML declaration node.

By default, declaration node is not created. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 203 of file rapidxml.hpp.

◆ parse_default

const int rapidxml::parse_default = 0

Parse flags which represent default behaviour of the parser.

This is always equal to 0, so that all other flags can be simply ored together. Normally there is no need to inconveniently disable flags by anding with their negated (~) values. This also means that meaning of each flag is a negation of the default setting. For example, if flag name is rapidxml::parse_no_utf8, it means that utf-8 is enabled by default, and using the flag will disable it.

See xml_document::parse() function.

Definition at line 276 of file rapidxml.hpp.

◆ parse_doctype_node

const int rapidxml::parse_doctype_node = 0x80

Parse flag instructing the parser to create DOCTYPE node.

By default, doctype node is not created. Although W3C specification allows at most one DOCTYPE node, RapidXml will silently accept documents with more than one. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 218 of file rapidxml.hpp.

◆ parse_fastest

const int rapidxml::parse_fastest = parse_non_destructive | parse_no_data_nodes

A combination of parse flags resulting in fastest possible parsing, without sacrificing important data.



See xml_document::parse() function.

Definition at line 291 of file rapidxml.hpp.

◆ parse_full

A combination of parse flags resulting in largest amount of data being extracted.

This usually results in slowest parsing.

See xml_document::parse() function.

Definition at line 297 of file rapidxml.hpp.

◆ parse_no_data_nodes

const int rapidxml::parse_no_data_nodes = 0x1

Parse flag instructing the parser to not create data nodes.

Text of first data node will still be placed in value of parent element, unless rapidxml::parse_no_element_values flag is also specified. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 166 of file rapidxml.hpp.

◆ parse_no_element_values

const int rapidxml::parse_no_element_values = 0x2

Parse flag instructing the parser to not use text of first data node as a value of parent element.

Can be combined with other flags by use of | operator. Note that child data nodes of element node take precendence over its value when printing. That is, if element has one or more child data nodes and a value, the value will be ignored. Use rapidxml::parse_no_data_nodes flag to prevent creation of data nodes if you want to manipulate data using values of elements.

See xml_document::parse() function.

Definition at line 175 of file rapidxml.hpp.

◆ parse_no_entity_translation

const int rapidxml::parse_no_entity_translation = 0x8

Parse flag instructing the parser to not translate entities in the source text.

By default entities are translated, modifying source text. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 189 of file rapidxml.hpp.

◆ parse_no_string_terminators

const int rapidxml::parse_no_string_terminators = 0x4

Parse flag instructing the parser to not place zero terminators after strings in the source text.

By default zero terminators are placed, modifying source text. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 182 of file rapidxml.hpp.

◆ parse_no_utf8

const int rapidxml::parse_no_utf8 = 0x10

Parse flag instructing the parser to disable UTF-8 handling and assume plain 8 bit characters.

By default, UTF-8 handling is enabled. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 196 of file rapidxml.hpp.

◆ parse_non_destructive

const int rapidxml::parse_non_destructive = parse_no_string_terminators | parse_no_entity_translation

A combination of parse flags that forbids any modifications of the source text.

This also results in faster parsing. However, note that the following will occur:

  • names and values of nodes will not be zero terminated, you have to use xml_base::name_size() and xml_base::value_size() functions to determine where name and value ends
  • entities will not be translated
  • whitespace will not be normalized

See xml_document::parse() function.

Definition at line 286 of file rapidxml.hpp.

◆ parse_normalize_whitespace

const int rapidxml::parse_normalize_whitespace = 0x800

Parse flag instructing the parser to condense all whitespace runs of data nodes to a single space character.

Trimming of leading and trailing whitespace of data is controlled by rapidxml::parse_trim_whitespace flag. By default, whitespace is not normalized. If this flag is specified, source text will be modified. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 250 of file rapidxml.hpp.

◆ parse_open_only

const int rapidxml::parse_open_only = 0x1000

Parse flag to say "Parse only the initial element opening." Useful for XMLstreams used in XMPP.

Definition at line 254 of file rapidxml.hpp.

◆ parse_parse_one

const int rapidxml::parse_parse_one = 0x2000

Parse flag to say "Toss the children of the top node and parse off one element.

Useful for parsing off XMPP top-level elements.

Definition at line 259 of file rapidxml.hpp.

◆ parse_pi_nodes

const int rapidxml::parse_pi_nodes = 0x100

Parse flag instructing the parser to create PI nodes.

By default, PI nodes are not created. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 225 of file rapidxml.hpp.

◆ parse_trim_whitespace

const int rapidxml::parse_trim_whitespace = 0x400

Parse flag instructing the parser to trim all leading and trailing whitespace of data nodes.

By default, whitespace is not trimmed. This flag does not cause the parser to modify source text. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 241 of file rapidxml.hpp.

◆ parse_validate_closing_tags

const int rapidxml::parse_validate_closing_tags = 0x200

Parse flag instructing the parser to validate closing tag names.

If not set, name inside closing tag is irrelevant to the parser. By default, closing tags are not validated. Can be combined with other flags by use of | operator.

See xml_document::parse() function.

Definition at line 233 of file rapidxml.hpp.

◆ parse_validate_xmlns

const int rapidxml::parse_validate_xmlns = 0x4000

Parse flag to say "Validate XML namespaces fully." This will generate additional errors, including unbound prefixes and duplicate attributes (with different prefices)

Definition at line 264 of file rapidxml.hpp.

◆ print_no_indenting

const int rapidxml::print_no_indenting = 0x1

Printer flag instructing the printer to suppress indenting of XML.

See print() function.

Definition at line 23 of file rapidxml_print.hpp.