Dv::Xml Namespace Reference


Classes

class  Document
 Convenience interface to xml::document. More...
class  Exception
 Exception class for Dv::Xml classes and functions. More...
struct  noconst
 Utility template: noconst<T>::mutable_type is T if T is not "const" and X if T is "const X". More...
struct  noconst< const T >
 Utility template: noconst<T>::mutable_type is T if T is not "const" and X if T is "const X". More...
struct  noconst< T * >
 Utility template: noconst<T>::mutable_type is T if T is not "const" and X if T is "const X". More...
class  Node
 Convenience interface to xml::node. More...

Functions

void iconv (const char *to_charset, const char *from_charset, std::string &target, const char *source) throw (std::runtime_error)
 Convert source C-string between character sets.
void iconv (const char *to_charset, const char *from_charset, std::string &target, const std::string &source) throw (std::runtime_error)
 Convert source C-string between character sets.
std::string iconv (const char *to_charset, const char *from_charset, const char *source) throw (std::runtime_error)
 Convert source C-string between character sets.
std::string iconv (const char *to_charset, const char *from_charset, const std::string &source) throw (std::runtime_error)
 Convert source C-string between character sets.
std::string iso2utf8 (const std::string &source) throw (std::runtime_error)
 Convert "ISO-8859-1" string to "UTF8" string.
std::string iso2utf8 (const char *source) throw (std::runtime_error)
 Convert "ISO-8859-1" C-string to "UTF8" string.
std::ostream & operator<< (std::ostream &os, const Node::Ref &ref)
 Print an XML tree rooted at the node referred to by a Dv::Xml::Node::Ref object.
Node::Ref operator/ (const Node::Ref &ref, const std::string &name) throw (Exception)
 Retrieve child node with matching name.
bool operator== (const Node::Ref &n, const Node::Ref &m)
 Equality test.
bool operator!= (const Node::Ref m, const Node::Ref &n)
 Inequality test.
Node::Ref operator>> (Node::Ref ref, const std::string &name) throw (Exception)
 Append new child node with given name.
Node::Ref operator>> (Node::Ref ref, const char *name) throw (Exception)
 Append new child node with given name.
Node::Ref operator>> (Node::Ref ref, Node::Ref child) throw (Exception)
 Append copy of node to children of this node.
std::ostream & operator<< (std::ostream &os, const Node::AttributeReference &a)
const char * to_html (unsigned char c) throw ()
 Convert to html representation.
std::string & to_html (const std::string &sin, std::string &sout) throw ()
 Convert string to html representation.
std::string to_html (const std::string &sin) throw ()
 Convert string to html representation.
Dv::Xml::Node date (const std::string &name, const Dv::Util::Date &d)
 Represent date as xml::node.


Function Documentation

void Dv::Xml::iconv ( const char *  to_charset,
const char *  from_charset,
std::string &  target,
const char *  source 
) throw (std::runtime_error)

Convert source C-string between character sets.

Parameters:
to_charset character set to convert to, e.g. "UTF8"
from_charset character set to convert from, e.g. "ISO-8859-1"
target string containing new version of source string.
source C-string
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

Referenced by iso2utf8().

void Dv::Xml::iconv ( const char *  to_charset,
const char *  from_charset,
std::string &  target,
const std::string &  source 
) throw (std::runtime_error)

Convert source C-string between character sets.

Parameters:
to_charset character set to convert to, e.g. "UTF8"
from_charset character set to convert from, e.g. "ISO-8859-1"
target string containing new version of source string.
source C-string
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

std::string Dv::Xml::iconv ( const char *  to_charset,
const char *  from_charset,
const char *  source 
) throw (std::runtime_error)

Convert source C-string between character sets.

Parameters:
to_charset character set to convert to, e.g. "UTF8"
from_charset character set to convert from, e.g. "ISO-8859-1"
source C-string
Returns:
string containing new version of source string (in target character set).
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

std::string Dv::Xml::iconv ( const char *  to_charset,
const char *  from_charset,
const std::string &  source 
) throw (std::runtime_error)

Convert source C-string between character sets.

Parameters:
to_charset character set to convert to, e.g. "UTF8"
from_charset character set to convert from, e.g. "ISO-8859-1"
source C-string
Returns:
string containing new version of source string (in target character set).
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

std::string Dv::Xml::iso2utf8 ( const std::string &  source  )  throw (std::runtime_error) [inline]

Convert "ISO-8859-1" string to "UTF8" string.

Parameters:
source string (using "ISO-8859-1" character set).
Returns:
string containing source string (in "UTF8" character set).
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

Definition at line 62 of file dviconv.h.

References iconv().

std::string Dv::Xml::iso2utf8 ( const char *  source  )  throw (std::runtime_error) [inline]

Convert "ISO-8859-1" C-string to "UTF8" string.

Parameters:
source string (using "ISO-8859-1" character set).
Returns:
string containing source string (in "UTF8" character set).
Exceptions:
std::runtime_error if anything goes wrong. Use iconv --list to see all supported character sets.

Definition at line 72 of file dviconv.h.

References iconv().

std::ostream& Dv::Xml::operator<< ( std::ostream &  os,
const Node::Ref &  ref 
)

Print an XML tree rooted at the node referred to by a Dv::Xml::Node::Ref object.

Parameters:
os stream to print to
ref reference to xml::node (may be invalid)
Warning:
The function will print "nil" if the object does not refer to a valid xml::node.

Node::Ref Dv::Xml::operator/ ( const Node::Ref &  ref,
const std::string &  name 
) throw (Exception) [inline]

Retrieve child node with matching name.

Parameters:
ref reference to xml::node of which child is to be found
name to match in returned child node
Returns:
Dv::Xml::Node::Ref referring to first child of this node that has name or nil.
Exceptions:
Dv::Xml::Exception if this Dv::Xml::Node::Ref does not refer to a valid xml::node.
See also:
Dv::Xml::Node::Ref::nil

Definition at line 581 of file node.h.

References Dv::Xml::Node::Ref::find(), Dv::Xml::Node::name(), and Dv::Xml::Node::ref().

bool Dv::Xml::operator== ( const Node::Ref &  n,
const Node::Ref &  m 
) [inline]

Equality test.

Parameters:
n Dv::Xml::Node::Ref to compare with.
m Dv::Xml::Node::Ref to compare with.
Returns:
true iff both nodes are nil or they refer to the same xml::node.

Definition at line 590 of file node.h.

References Dv::Xml::Node::Ref::equals().

bool Dv::Xml::operator!= ( const Node::Ref  m,
const Node::Ref &  n 
) [inline]

Inequality test.

Parameters:
m Dv::Xml::Node::Ref to compare with.
n Dv::Xml::Node::Ref to compare with.
Returns:
true iff the nodes are not equal
See also:
Dv::Xml::operator==(const Node::Ref& n, const Node::Ref& m)

Definition at line 600 of file node.h.

References Dv::Xml::Node::Ref::equals().

Node::Ref Dv::Xml::operator>> ( Node::Ref  ref,
const std::string &  name 
) throw (Exception) [inline]

Append new child node with given name.

Parameters:
ref to node to which a new child node will be appended.
name for new child node.
Returns:
Dv::Xml::Node::Ref referring to new child of this node that has name.
Exceptions:
Dv::Xml::Exception if ref does not refer to a valid xml::node.

Definition at line 612 of file node.h.

References Dv::Xml::Node::Ref::add(), Dv::Xml::Node::name(), and Dv::Xml::Node::ref().

Node::Ref Dv::Xml::operator>> ( Node::Ref  ref,
const char *  name 
) throw (Exception) [inline]

Append new child node with given name.

Parameters:
ref to node to which a new child node will be appended.
name for new child node.
Returns:
Dv::Xml::Node::Ref referring to new child of this node that has name.
Exceptions:
Dv::Xml::Exception if ref does not refer to a valid xml::node.

Definition at line 624 of file node.h.

References Dv::Xml::Node::Ref::add(), Dv::Xml::Node::name(), and Dv::Xml::Node::ref().

Node::Ref Dv::Xml::operator>> ( Node::Ref  ref,
Node::Ref  child 
) throw (Exception) [inline]

Append copy of node to children of this node.

Parameters:
ref reference to xml::node to which a child will be added.
child a copy of which will be added to the children of this node.
Returns:
Dv::Xml::Node::Ref referring to the new child of this node.
Exceptions:
Dv::Xml::Exception if either of the parameters does not refer to a valid xml::node.

Definition at line 635 of file node.h.

References Dv::Xml::Node::Ref::add(), and Dv::Xml::Node::ref().

std::ostream& Dv::Xml::operator<< ( std::ostream &  os,
const Node::AttributeReference &  a 
) [inline]

Definition at line 639 of file node.h.

References Dv::Xml::Node::AttributeReference::str().

const char* Dv::Xml::to_html ( unsigned char  c  )  throw ()

Convert to html representation.

E.g. '&' becomes '&' etc.

Parameters:
c char to convert
Returns:
HTML representation of c

std::string& Dv::Xml::to_html ( const std::string &  sin,
std::string &  sout 
) throw ()

Convert string to html representation.

E.g. '&' becomes '&' etc.

Parameters:
sin string to convert.
sout string to which result of conversion will be appended.
Returns:
reference to sout.

std::string Dv::Xml::to_html ( const std::string &  sin  )  throw ()

Convert string to html representation.

E.g. '&' becomes '&' etc.

Parameters:
sin string to convert.
Returns:
converted string

Dv::Xml::Node Dv::Xml::date ( const std::string &  name,
const Dv::Util::Date d 
)

Represent date as xml::node.

Parameters:
name tag of main xml::node.
d date to represent.
Returns:
Dv::Xml::Node representing d.


dvxml-0.1.7 [ 7 January, 2008]