Actin®  Version 5.2.0
Software for Robotics Simulation and Control
EcXmlWriter Class Reference

XML file writer. More...

#include <ecXmlWriter.h>

Classes

struct  ElementStruct
 Structure containing element and namespace map. More...
 

Public Types

enum  XML_WRITER_MODE {
  NEW_FILE,
  START_TAG,
  ATTRIBUTE_NAME,
  ATTRIBUTE_VALUE,
  CONTENT,
  END_TAG,
  ERROR_FOUND
}
 XML Writer Mode. More...
 
enum  LANGUAGE {
  basicXML,
  MCML_V1_0_0
}
 Define the different languages available. More...
 

Public Member Functions

 EcXmlWriter ()
 Default constructor.
 
 EcXmlWriter (const EcString &filename, std::ostream &stream)
 Constructor with filename argument. More...
 
virtual ~EcXmlWriter ()
 Default destructor.
 
 EcXmlWriter (const EcXmlWriter &orig)
 copy constructor
 
EcXmlWriteroperator= (const EcXmlWriter &orig)
 assignment operator
 
virtual void writeStartTag (const EcToken &elementName)
 open start tag More...
 
virtual void writeStartTagUsingParentNamespace (const EcToken &elementName)
 open start tag More...
 
virtual void setAttributeName (const EcToken &attributeName)
 put attribute name More...
 
virtual void setNumOfContentColumns (const EcSizeT size)
 set the number of columns for content More...
 
virtual void writeEndTag ()
 put end tag More...
 
virtual const EcStringindent () const
 get indent
 
virtual void setIndent (const EcString &indent)
 set indent
 
virtual const EcStringheader () const
 get header
 
virtual void setHeader (const EcString &header)
 set header
 
virtual const EcStringstyleSheet () const
 get style sheet
 
virtual void setStyleSheet (const EcString &styleSheet)
 set style sheet
 
virtual const EcStringschemaInstance () const
 get schema instance
 
virtual void setSchemaInstance (const EcString &schemaInstance)
 set schema instance
 
virtual const EcStringschemaLocation () const
 get schema location
 
virtual void setSchemaLocation (const EcString &schemaLocation)
 set schema location
 
virtual void setLanguageSelection (LANGUAGE langaugeID)
 Define the languages.
 
virtual void type (const std::type_info &typeInfo)
 Get type information of content.
 
virtual void data (const EcString &data)
 put data More...
 
virtual EcBoolean writeDefaultDataFlag () const
 Get write default flag.
 
virtual void setWriteDefaultDataFlag (EcBoolean writeDefaultDataFlag)
 Set write default flag.
 
virtual void setLinkTotal (EcSizeT linkTotal)
 set link total
 
virtual void resetLinkCount ()
 reset link count to zero
 
virtual void incrementLinkCount ()
 Increment link count.
 

Static Public Member Functions

static const EcStringdefaultIndent ()
 get default indent
 
static void setDefaultIndent (const EcString &indent)
 set default indent
 
static const EcStringdefaultHeader ()
 get default header
 
static void setDefaultHeader (const EcString &header)
 set default header
 
static const EcStringdefaultStyleSheet ()
 get default style sheet
 
static void setDefaultStyleSheet (const EcString &styleSheet)
 set default style sheet
 
static const EcStringdefaultSchemaInstance ()
 get default schema instance
 
static void setDefaultSchemaInstance (const EcString &schemaInstance)
 set default schema instance
 
static const EcStringdefaultSchemaLocation ()
 get default schema location
 
static void setDefaultSchemaLocation (const EcString &schemaLocation)
 set default schema location
 
static void setDefaultLanguageSelection (LANGUAGE langaugeID)
 Define the default languages.
 
static void setDefaultForWriteDefaultDataFlag (EcBoolean writeDefaultDataFlag)
 Set default for write default flag.
 

Public Attributes

std::ostringstream m_Buffer
 Internal buffer.
 

Protected Member Functions

virtual void attributeValue (const EcString &data)
 put attribute value (called from Data()) More...
 
virtual void content (const EcString &data)
 put content (called from Data()) More...
 
virtual void setSchemaWriter (const EcBoolean writeSchema)
 set schema writer
 
virtual void header (const EcToken &elementName, const EcString &namespaceUri)
 put header information More...
 
virtual void tab (const EcSizeT size=1)
 put header information More...
 

Static Protected Member Functions

static void setDefaultSchemaWriter (const EcBoolean writeSchema)
 set default schema writer
 

Protected Attributes

std::ostream & m_Stream
 Output stream.
 
EcString m_FileName
 File name.
 
XML_WRITER_MODE m_XmlWriterMode
 XML writer mode.
 
std::stack< ElementStructm_ElementStack
 Element name.
 
EcString m_DefaultNamespace
 Default namespace.
 
EcString m_Content
 Data container.
 
EcSizeT m_ContentCount
 Data counter.
 
EcSizeT m_ContentColumns
 Content columns.
 
EcBoolean m_WriteDefaultDataFlag
 Short File Flag.
 
EcString m_Indent
 indent size
 
EcString m_Header
 XML header.
 
EcString m_StyleSheetLocation
 style sheet location
 
EcString m_SchemaInstance
 schema instance name
 
EcString m_SchemaLocation
 schema location
 
EcXmlSchema m_Schema
 Schema generator.
 
EcBoolean m_WriteSchema
 Flag for writing schema.
 
EcString m_Type
 Content type name.
 
EcSizeT m_LinkTotal
 total number of links
 
EcSizeT m_LinkCount
 Link count.
 

Static Protected Attributes

static EcBoolean m_theWriteDefaultDataFlag
 Default short File Flag.
 
static EcString m_theIndent
 default indent size
 
static EcString m_theHeader
 default XML header
 
static EcString m_theStyleSheetLocation
 default style sheet location
 
static EcString m_theSchemaInstance
 default schema instance name
 
static EcString m_theSchemaLocation
 default schema location
 
static EcBoolean m_theWriteSchema
 Static flag for writing schema.
 

Detailed Description

XML file writer.

Examples:
ecXmlMain.cpp.

Definition at line 19 of file ecXmlWriter.h.

Member Enumeration Documentation

Define the different languages available.

Enumerator
basicXML 

Basic XML file.

MCML_V1_0_0 

MCML v1.0.0 file.

Definition at line 35 of file ecXmlWriter.h.

XML Writer Mode.

Enumerator
NEW_FILE 

Initial state.

START_TAG 

Start tag opened.

ATTRIBUTE_NAME 

Attribute name written.

ATTRIBUTE_VALUE 

Attribute value written.

CONTENT 

Content written.

END_TAG 

Tag closed.

ERROR_FOUND 

Error found.

Definition at line 23 of file ecXmlWriter.h.

Constructor & Destructor Documentation

EcXmlWriter::EcXmlWriter ( const EcString filename,
std::ostream &  stream 
)

Constructor with filename argument.

Parameters
filenameDestination file for writing
streamStream used to write to destination

Member Function Documentation

virtual void EcXmlWriter::attributeValue ( const EcString data)
protectedvirtual

put attribute value (called from Data())

Parameters
dataAttribute data
virtual void EcXmlWriter::content ( const EcString data)
protectedvirtual

put content (called from Data())

Parameters
dataAttribute data
virtual void EcXmlWriter::data ( const EcString data)
virtual

put data

Data could be attribute value or element content, which is determined by context

Parameters
dataInput data

Referenced by operator<<().

virtual void EcXmlWriter::header ( const EcToken elementName,
const EcString namespaceUri 
)
protectedvirtual

put header information

Parameters
elementNameRoot element name that is written at end of header
namespaceUriURI for namespace definition
virtual void EcXmlWriter::setAttributeName ( const EcToken attributeName)
virtual

put attribute name

Parameters
attributeNameAttribute name
virtual void EcXmlWriter::setNumOfContentColumns ( const EcSizeT  size)
virtual

set the number of columns for content

Parameters
sizeNumber of columns
virtual void EcXmlWriter::tab ( const EcSizeT  size = 1)
protectedvirtual

put header information

Tabs are actually two spaces apiece

Parameters
sizeNumber of tabs written
virtual void EcXmlWriter::writeEndTag ( )
virtual

put end tag

Return values
Errorflag
virtual void EcXmlWriter::writeStartTag ( const EcToken elementName)
virtual

open start tag

Parameters
elementNameElement name
virtual void EcXmlWriter::writeStartTagUsingParentNamespace ( const EcToken elementName)
virtual

open start tag

Use parent's namespace

Parameters
elementNameElement name

The documentation for this class was generated from the following file:
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.