XMLWriter Class Reference

This class provides an interface to produce XML document. More...

#include <xmlwriter.h>

List of all members.

Public Member Functions

 XMLWriter (const std::string &sEncoding=DEFAULT_ENCODING)
 Constructor.
 ~XMLWriter ()
 Destructor.
void startDocument () throw (XMLWritingException)
 Starts the XML document.
void addElement (const std::string &name, const std::string &value)
 Adds a element to the xml document.
void addElement (const std::string &name, const std::string &value, const AttributesImpl &atts)
 Adds a element to the xml document.
void startElement (const std::string &name, bool bEndLine=true)
 Starts a new element.
void startElement (const std::string &name, const AttributesImpl &atts, bool bEndLine=true)
 Starts a new element.
void endElement (const std::string &name)
 Ends a element.
void endDocument ()
 Ends XML document.
std::string getEncoding () const
 Returns the characters encoding charset.
void setEncoding (const std::string &charset)
 Sets the characters encoding charset.
void setRootNode (const std::string &sRootNode)
 Sets the root node.
std::string getRootNode () const
 Returns the root node.
std::string getXMLDocument () const
 Returns the XML document as string.

Static Public Attributes

static const char * DEFAULT_ENCODING = "ISO-8859-15"
 Default encoding used : ISO-8859-15.


Detailed Description

This class provides an interface to produce XML document.

It only provides a interface for writing XML document, it doesn't provdies an interface for verifying the document. It's possible to produce a non valid document if it is not correctly used.

Author:
Sylvain Archenault <sylvain.archenault@laposte.net>

Yves Houpert <yves.houpert@insa-rouen.fr>


Constructor & Destructor Documentation

XMLWriter::XMLWriter const std::string &  sEncoding = DEFAULT_ENCODING  ) 
 

Constructor.

Parameters:
sEncoding Character encoding charset.


Member Function Documentation

void XMLWriter::addElement const std::string &  name,
const std::string &  value,
const AttributesImpl atts
 

Adds a element to the xml document.

Parameters:
name Node name.
value Node value or content.
atts Attributes add to the node.

void XMLWriter::addElement const std::string &  name,
const std::string &  value
 

Adds a element to the xml document.

Parameters:
name Node name.
value Node value or content.

void XMLWriter::endDocument  ) 
 

Ends XML document.

It closes the root node tag.

void XMLWriter::endElement const std::string &  name  ) 
 

Ends a element.

Parameters:
name Node to end.

std::string XMLWriter::getEncoding  )  const [inline]
 

Returns the characters encoding charset.

Returns:
Characters encoding charset.

std::string XMLWriter::getRootNode  )  const [inline]
 

Returns the root node.

Returns:
The root node.

std::string XMLWriter::getXMLDocument  )  const [inline]
 

Returns the XML document as string.

Returns:
XML Document.

void XMLWriter::setEncoding const std::string &  charset  ) 
 

Sets the characters encoding charset.

Parameters:
charset Characters encoding charset.

void XMLWriter::setRootNode const std::string &  sRootNode  )  [inline]
 

Sets the root node.

Parameters:
sRootNode The root node.

void XMLWriter::startDocument  )  throw (XMLWritingException)
 

Starts the XML document.

It writes the xml tag and the root node. This one should be sent, otherwise, it throws a XMLWritingException.

Exceptions:
XMLWritingException 

void XMLWriter::startElement const std::string &  name,
const AttributesImpl atts,
bool  bEndLine = true
 

Starts a new element.

Parameters:
name Node name.
atts Attributes to add to the node.
bEndLine true to end the line.

void XMLWriter::startElement const std::string &  name,
bool  bEndLine = true
 

Starts a new element.

Parameters:
name Node name.
bEndLine true to end the line.


The documentation for this class was generated from the following files:
Generated on Fri May 19 12:15:55 2006 for Bamboo Ch@t by  doxygen 1.4.6