version 3.3

VRS::XMLWriterUtil Class Reference

XMLWriterUtil provides simple static methods to write XML element tags. More...

#include <vrs/io/xmlwriterutil.h>

Inheritance diagram for VRS::XMLWriterUtil:

VRS::SharedObj VRS::Visitable VRS::XMLNamespaceAwareWriterUtil

List of all members.

Public Types

typedef std::pair< std::string,
std::string > 
XMLAttribute
 Represents an XML attribute in the form (<attrib-name>, <attrib-value>).

Public Member Functions

 XMLWriterUtil (std::ostream &target, int indentPerLevel=2)
 Creates an XMLWriter util that streams data into a given output stream.
void writeXMLDeclaration (const std::string &version="1.0", const std::string &encoding="utf-8")
 Writes out the XML declaration <?xml .. ?> at the beginning of a document.
virtual void writeOpenTag (const std::string &elementName, SO< VRS::Iterator< XMLAttribute > > attributes=NULL, bool singleLine=false)
 Writes an XML open tag with the given attributes.
virtual void writeOpenCloseTag (const std::string &elementName, SO< VRS::Iterator< XMLAttribute > > attributes=NULL)
 Writes an XML open tag that is closed without having any children (eg.
virtual void writeCloseTag ()
 Writes an XML closing attribute for the currently open XML tag.
std::ostream & target ()
 provides direct access to the output stram
 VRS_TYPEINFO (XMLWriterUtil, SharedObj)


Detailed Description

XMLWriterUtil provides simple static methods to write XML element tags.

It is not needed for the implementation of DOM XML writers.


Member Typedef Documentation

typedef std::pair<std::string, std::string> VRS::XMLWriterUtil::XMLAttribute

Represents an XML attribute in the form (<attrib-name>, <attrib-value>).


Constructor & Destructor Documentation

VRS::XMLWriterUtil::XMLWriterUtil ( std::ostream &  target,
int  indentPerLevel = 2 
)

Creates an XMLWriter util that streams data into a given output stream.

'indentPerLevel' specifies spacing ident that is left per hierarchy level, i.e., the root element has indent 0, the 1-level element has an indent of 'indentPerLevel'...


Member Function Documentation

void VRS::XMLWriterUtil::writeXMLDeclaration ( const std::string &  version = "1.0",
const std::string &  encoding = "utf-8" 
)

Writes out the XML declaration <?xml .. ?> at the beginning of a document.

virtual void VRS::XMLWriterUtil::writeOpenTag ( const std::string &  elementName,
SO< VRS::Iterator< XMLAttribute > >  attributes = NULL,
bool  singleLine = false 
) [virtual]

Writes an XML open tag with the given attributes.

'attributes' may be NULL. If 'singleLine' is true, the whole element and any child elements are written in a single line until the closeTag is reached. This should be used for very short elements only.

virtual void VRS::XMLWriterUtil::writeOpenCloseTag ( const std::string &  elementName,
SO< VRS::Iterator< XMLAttribute > >  attributes = NULL 
) [virtual]

Writes an XML open tag that is closed without having any children (eg.

<tag a="b">) with the given attributes. 'attributes' may be NULL.

virtual void VRS::XMLWriterUtil::writeCloseTag (  )  [virtual]

Writes an XML closing attribute for the currently open XML tag.

writeCloseTag() can only be called if an XML Open tag has been written.

Reimplemented in VRS::XMLNamespaceAwareWriterUtil.

std::ostream& VRS::XMLWriterUtil::target (  ) 

provides direct access to the output stram

VRS::XMLWriterUtil::VRS_TYPEINFO ( XMLWriterUtil  ,
SharedObj   
)


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

Generated on Wed May 23 06:00:19 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact