Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

Dv::Xml::Document Class Reference

Convenience interface to xml::document. More...

#include <doc.h>

List of all members.

Public Member Functions

 Document ()
 Default ctor.

 Document (const Dv::Xml::Node::Ref &ref) throw (Dv::Xml::Exception)
 Construct a Dv::Xml::Document out of a (copy of a) Dv::Xml::Node object.

 Document (const Dv::Util::File &file) throw (Dv::Xml::Exception)
 Parse a Dv::Xml::Document from a file.

 Document (const std::string &name, const std::string &content) throw (Dv::Xml::Exception)
 Create a Dv::Xml::Document with a root labeled with given name and content.

 Document (const std::string &name) throw (Dv::Xml::Exception)
 Create a Dv::Xml::Document with a root labeled with given name.

 Document (const char *pc, size_t size) throw (Dv::Xml::Exception)
 Parse a Dv::Xml::Document from an array of characters .

 Document (const std::string &stylesheet, Dv::Xml::Document &doc) throw (Dv::Xml::Exception)
 Create a Dv::Xml::Document by applying an XSLT stylesheet to another Document.

virtual ~Document ()
 Destructor.

Dv::Xml::Documentparse (const char *data, size_t size) throw (Dv::Xml::Exception)
 Parse a Dv::Xml::Document from an array of characters .

Dv::Xml::Documentparse (const std::string &filenm) throw (Dv::Xml::Exception)
 Parse a Dv::Xml::Document from a filenm.

Documentoperator= (const Dv::Xml::Node::Ref &ref) throw (Dv::Xml::Exception)
 Set root.

void root (const Dv::Xml::Node::Ref &ref) throw (Dv::Xml::Exception)
 Set root.

Dv::Xml::Node::Ref root () const
 Get root Dv::Xml::Node of Document.

 operator Dv::Xml::Node::Ref () const
 Convert to reference to root of document.

const std::string & encoding () const
 Get encoding of Document.

Dv::Xml::Documentencoding (const std::string &enc)
 Set encoding of Document.

bool valid (const std::string &dtd="")
 Validate document w.r.t.

Dv::Xml::Node::Ref select (const std::string &path) const throw (Dv::Xml::Exception)
 Select node after path from document.


Detailed Description

Convenience interface to xml::document.

Definition at line 20 of file doc.h.


Constructor & Destructor Documentation

Dv::Xml::Document::Document  )  [explicit]
 

Default ctor.

Dv::Xml::Document::Document const Dv::Xml::Node::Ref ref  )  throw (Dv::Xml::Exception) [explicit]
 

Construct a Dv::Xml::Document out of a (copy of a) Dv::Xml::Node object.

Parameters:
ref Dv::Xml::Node::Ref, a copy of which will be used as the root of the new Dv::Xml::Document object.
Exceptions:
Dv::Xml::Exception if node is not valid.

Dv::Xml::Document::Document const Dv::Util::File file  )  throw (Dv::Xml::Exception) [explicit]
 

Parse a Dv::Xml::Document from a file.

Parameters:
file containing document
Exceptions:
Dv::Xml::Exception upon any error

Dv::Xml::Document::Document const std::string &  name,
const std::string &  content
throw (Dv::Xml::Exception) [explicit]
 

Create a Dv::Xml::Document with a root labeled with given name and content.

Parameters:
name to be used as the label of the root of the document
content to be used as the content of the root of the document
Exceptions:
Dv::Xml::Exception upon any error

Dv::Xml::Document::Document const std::string &  name  )  throw (Dv::Xml::Exception) [explicit]
 

Create a Dv::Xml::Document with a root labeled with given name.

Parameters:
name to be used as the label of the root of the document
Exceptions:
Dv::Xml::Exception upon any error

Dv::Xml::Document::Document const char *  pc,
size_t  size
throw (Dv::Xml::Exception) [explicit]
 

Parse a Dv::Xml::Document from an array of characters .

Parameters:
pc pointer to the start of the data
size of the data array
Exceptions:
Dv::Xml::Exception upon any error

Dv::Xml::Document::Document const std::string &  stylesheet,
Dv::Xml::Document doc
throw (Dv::Xml::Exception) [explicit]
 

Create a Dv::Xml::Document by applying an XSLT stylesheet to another Document.

Parameters:
stylesheet filename of xslt file
doc input document
Exceptions:
Dv::Xml::Exception upon any error

virtual Dv::Xml::Document::~Document  )  [virtual]
 

Destructor.


Member Function Documentation

Dv::Xml::Document& Dv::Xml::Document::parse const char *  data,
size_t  size
throw (Dv::Xml::Exception)
 

Parse a Dv::Xml::Document from an array of characters .

The result replaces the current contents of this document.

Parameters:
data pointer to the start of the data
size of the data array
Returns:
reference to this document
Exceptions:
Dv::Xml::Exception upon any error

Dv::Xml::Document& Dv::Xml::Document::parse const std::string &  filenm  )  throw (Dv::Xml::Exception)
 

Parse a Dv::Xml::Document from a filenm.

The result replaces the current contents of this document.

Parameters:
filenm name of file where document can be found.
Returns:
reference to this document
Exceptions:
Dv::Xml::Exception upon any error

Document& Dv::Xml::Document::operator= const Dv::Xml::Node::Ref ref  )  throw (Dv::Xml::Exception)
 

Set root.

Parameters:
ref reference to node to copy to root of this document.
Exceptions:
Dv::Xml::Exception if ref does not refer to a valid xml::node.
See also:
Dv::Xml::Document::root(const Dv::Xml::Node& node)

void Dv::Xml::Document::root const Dv::Xml::Node::Ref ref  )  throw (Dv::Xml::Exception)
 

Set root.

Parameters:
ref reference to node that will be copied to the root of this document.
Exceptions:
Dv::Xml::Exception if node is not valid.
See also:
Dv::Xml::Node

Dv::Xml::Node::Ref Dv::Xml::Document::root  )  const
 

Get root Dv::Xml::Node of Document.

Returns:
root Dv::Xml::Node of Document.
Warning:
Assigning the result does not change the root. Updating is possible, as in the example below.
 Dv::Xml::Document doc;
 ..
 (doc.root() >> "child" >> "grandchild")["name"] = "Pete";

Referenced by operator Dv::Xml::Node::Ref().

Dv::Xml::Document::operator Dv::Xml::Node::Ref  )  const [inline]
 

Convert to reference to root of document.

See also:
Dv::Xml::Document::root

Definition at line 117 of file doc.h.

References operator Dv::Xml::Node::Ref(), and root().

Referenced by operator Dv::Xml::Node::Ref().

const std::string& Dv::Xml::Document::encoding  )  const [inline]
 

Get encoding of Document.

Default is "ISO-8859-1".

Returns:
encoding of Document.

Definition at line 122 of file doc.h.

Dv::Xml::Document& Dv::Xml::Document::encoding const std::string &  enc  )  [inline]
 

Set encoding of Document.

Parameters:
enc encoding of Document
Returns:
*this

Definition at line 128 of file doc.h.

bool Dv::Xml::Document::valid const std::string &  dtd = ""  ) 
 

Validate document w.r.t.

DTD.

Parameters:
dtd url or filename of DTD, if empty, the dtd is assumed to have been included in the document.
Returns:
true iff the document is valid w.r.t the DTD.

Dv::Xml::Node::Ref Dv::Xml::Document::select const std::string &  path  )  const throw (Dv::Xml::Exception)
 

Select node after path from document.

Parameters:
path of the form "a/b/c"
Returns:
node at the end of the path
Exceptions:
Dv::Xml::Exception if node is not valid.


The documentation for this class was generated from the following file:
dvxml-0.1.4 [19 September, 2003]