sptk2 logo
SPTK Home Page

sptk::CXmlDoc Class Reference
[XML]

XML document. More...

#include <CXmlDoc.h>

Inheritance diagram for sptk::CXmlDoc:

sptk::CSharedStrings sptk::CXmlElement sptk::CXmlNamedItem sptk::CXmlNode sptk::CRegistry

List of all members.

Public Member Functions

 CXmlDoc ()
 Constructs an empty document, without doctype.
 CXmlDoc (const char *name, const char *public_id=0, const char *system_id=0)
virtual ~CXmlDoc ()
 Destructor.
virtual CXmlNodeType type () const
 Returns node type.
virtual void clear ()
 Destroys all nodes in document.
virtual const std::string & name () const
 Returns the node name.
virtual void name (const std::string &name)
 Sets the new name for the node.
virtual void name (const char *name)
 Sets new name for node.
CXmlDocTypedocType ()
const CXmlDocTypedocType () const
CXmlNoderootNode ()
 Returns pointer to root element of document.
virtual void load (const char *buffer)
virtual void load (const CBuffer &buffer)
virtual void save (CBuffer &buffer, int indent=0) const

Static Public Member Functions

static int indentSpaces ()
 Returns indentation in save.
static void indentSpaces (int i)
 Set indentation in save, defaults to 2.

Protected Member Functions

CXmlNodecreateElement (const char *tagname)

Protected Attributes

CBuffer m_decodeBuffer
 Decode and encode buffer.

Friends

class CXmlNode


Detailed Description

XML document.

Represents the entire XML document. It provides access to document root node, which includes all nodes in XML document tree.


Constructor & Destructor Documentation

sptk::CXmlDoc::CXmlDoc ( const char *  name,
const char *  public_id = 0,
const char *  system_id = 0 
)

Constructs an empty document, with doctype.

Parameters:
name const char *, name of the document.
public_id const char *, public id of the document, placed on DOCTYPE declaration
system_id const char *, system id of the document, placed on DOCTYPE declaration


Member Function Documentation

CXmlNode* sptk::CXmlDoc::createElement ( const char *  tagname  )  [protected]

Creates new named node of type CXmlNode::DOM_ELEMENT. It can be added to document DOM tree.

Parameters:
tagname const char *, name of the element
See also:
CXmlNode

const CXmlDocType& sptk::CXmlDoc::docType (  )  const [inline]

Returns doctype of document. You can use it to add e.g. custom entities.

        mydoc->doctype().set_entity("myentity", "myreplacement");
        

CXmlDocType& sptk::CXmlDoc::docType (  )  [inline]

Returns doctype of document. You can use it to add e.g. custom entities.

        mydoc->doctype().set_entity("myentity", "myreplacement");
        

static void sptk::CXmlDoc::indentSpaces ( int  i  )  [inline, static]

Set indentation in save, defaults to 2.

Parameters:
i as new indent spaces

virtual void sptk::CXmlDoc::load ( const CBuffer buffer  )  [inline, virtual]

Loads document from buffer.

Parameters:
buffer const CBuffer&, source buffer

Reimplemented in sptk::CRegistry.

References sptk::CBuffer::c_str(), and load().

virtual void sptk::CXmlDoc::load ( const char *  buffer  )  [virtual]

Loads document from buffer.

Parameters:
buffer const char*, source buffer

Reimplemented in sptk::CRegistry.

Referenced by load(), and sptk::CRegistry::load().

virtual void sptk::CXmlDoc::name ( const char *  name  )  [inline, virtual]

Sets new name for node.

Parameters:
name const char *, new node name

Reimplemented from sptk::CXmlNamedItem.

virtual void sptk::CXmlDoc::name ( const std::string &  name  )  [inline, virtual]

Sets the new name for the node.

Parameters:
name const std::string&, new node name

Reimplemented from sptk::CXmlNamedItem.

virtual const std::string& sptk::CXmlDoc::name (  )  const [inline, virtual]

Returns the node name.

The meaning of the value depends on the node type

Reimplemented from sptk::CXmlNamedItem.

virtual void sptk::CXmlDoc::save ( CBuffer buffer,
int  indent = 0 
) const [virtual]

Saves document to buffer.

Parameters:
buffer CBuffer&, a buffer to save document
indent int, how many indent spaces at start

Reimplemented from sptk::CXmlNode.

Reimplemented in sptk::CRegistry.

Referenced by sptk::CRegistry::save().


The documentation for this class was generated from the following file:

Mon Mar 5 11:56:22 2012: SPTK 3.5.7