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

An XML parser object that can read a single file. More...

#include <ecXmlFileReader.h>

Classes

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

Public Types

enum  XML_READER_MODE {
  EOF_FOUND,
  START_TAG,
  END_TAG,
  EMPTY_TAG,
  CONTENT,
  ERROR_FOUND
}
 XML Reader Mode. More...
 

Public Member Functions

 EcXmlFileReader ()
 Default constructor.
 
 EcXmlFileReader (const EcString &filename, std::istream &stream)
 Constructor with filename argument. More...
 
virtual ~EcXmlFileReader ()
 Default destructor.
 
 EcXmlFileReader (const EcXmlFileReader &orig)
 copy constructor
 
EcXmlFileReaderoperator= (const EcXmlFileReader &orig)
 assignment operator
 
virtual XML_READER_MODE readXml ()
 Executive for XML processing. More...
 
virtual std::istream & stream () const
 Get input stream.
 
virtual const char * filename () const
 
virtual EcU32 errorCode () const
 Get error code.
 
virtual void setErrorCode (EcU32 error)
 Set error code.
 
virtual XML_READER_MODE mode () const
 Get mode.
 
virtual const EcTokenelement () const
 Get element name.
 
virtual const EcTokenattributeName () const
 Get next attribute name.
 
virtual const EcTokenattributeName (const EcToken &key) const
 Get next attribute name given key.
 
virtual const EcStringattributeValue ()
 Get next attribute value (then pop value -> nonconst)
 
virtual const EcStringattributeValue (const EcToken &key)
 Get next attribute value given key (then pop value -> nonconst)
 
virtual EcSizeT numOfAttributes () const
 Get original size of attribute queue.
 
virtual EcSizeT remainingNumOfAttributes () const
 Get size of attribute name queue.
 
virtual const EcStringcontent () const
 Get content.
 
virtual const EcStringcontentByWord () const
 Get next word of content.
 
virtual const EcSizeT contentCount () const
 Get number of items in content.
 
virtual EcBoolean isContentAvailable () const
 Test for content.
 
virtual void setContentVectorFlag (EcBoolean contentVectorFlag=EcTrue)
 Set content vector flag.
 
virtual EcInt32 lineCountOfFile () const
 Get line count.
 
virtual EcBoolean nextMatchingEndTag ()
 Continue reading to matching end tag for current element. More...
 
virtual EcBoolean nextMatchingEndTagWithErrorChecking ()
 Continue reading to matching end tag for current element. More...
 
virtual const EcStringgetChildrenAsString ()
 Get childen content as string. More...
 
virtual const EcStringgetComplexStartTagFast ()
 
virtual const EcStringgetSimpleStartTagFast ()
 
virtual const EcStringgetAttributeValueFast ()
 Get next attribute value (fast without error checking)
 
virtual const EcStringgetLastAttributeValueFast ()
 Get last attribute value (fast without error checking)
 
virtual const EcStringgetContentByWordFast ()
 Get next content word (fast without error checking)
 
virtual void getEndTagFast ()
 Get end tag (fast without error checking)
 

Protected Types

enum  DEFAULT_NAMESPACE_OPTION {
  ELEMENT,
  ATTRIBUTE
}
 default namespace option More...
 
typedef std::stack< ElementStructElementStackType
 A type definition for the stack type based on std::stack.
 
typedef std::map< EcToken, EcStringAttributeMapType
 A type definition for the Attribute map using std::map.
 

Protected Member Functions

virtual EcXmlFileReader::XML_READER_MODE nextEvent ()
 Get next input from stream. More...
 
virtual EcXmlFileReader::XML_READER_MODE tagType (EcString &tag)
 What kind of tag? More...
 
virtual EcBoolean parseElementAndAttributes (EcString &tag)
 Get element and attributes. More...
 
virtual const EcTokenswapNamespacePrefixWithUri (EcToken &input, DEFAULT_NAMESPACE_OPTION option=ELEMENT) const
 Swap namespace prefix with URI. More...
 
virtual const EcStringnextWord (EcString &input) const
 Get next word from input string. More...
 
virtual const EcSizeT wordCount (const EcString &input) const
 Get word count. More...
 
virtual const EcStringnextQuotedToken (EcString &input) const
 Get quoted token. More...
 
virtual EcBoolean getLineWithLineCount (EcString &input, const char delim, EcBoolean eatDelim)
 Read file and count lines using getline() More...
 
virtual EcBoolean isComment (EcString &input)
 Is input a comment? More...
 
virtual void stripWhiteSpaceFromBounds (EcString &input) const
 Strip white space from bounds. More...
 
virtual void stripLeadingWhiteSpace (EcString &input) const
 Strip leading white space. More...
 
virtual void stripTrailingWhiteSpace (EcString &input) const
 Strip trailing white space. More...
 
virtual void stripLeadingSlash (EcString &input) const
 Strip leading slash from input. More...
 
virtual void stripTrailingSlash (EcString &input) const
 Strip trailing slash from input. More...
 
virtual void stripQuotes (EcString &input) const
 Strip quotes from input. More...
 
virtual EcBoolean isWhiteSpace (EcString &input) const
 Does input have data? More...
 
virtual void warnMessage (const char *message) const
 Emits a warning message. More...
 

Protected Attributes

std::istream & m_Stream
 Input stream.
 
EcString m_Filename
 File name.
 
EcU32 m_ErrorCode
 Error code.
 
XML_READER_MODE m_XmlReaderMode
 XML reader mode.
 
ElementStackType m_ElementStack
 The element stack.
 
AttributeMapType m_AttributeMap
 Attribute map.
 
EcSizeT m_NumOfAttributes
 Number of attributes.
 
EcString m_Content
 Content.
 
EcBoolean m_ContentVectorFlag
 Content vector flag.
 
EcInt32 m_LineCount
 File line count.
 
EcToken m_EndTag
 End tag element name.
 
EcToken m_ReturnToken
 Temporary return token (speeds up code)
 
EcString m_ReturnString
 Temporary return string (speeds up code)
 
EcString m_UtilityInputString
 Temporary utility input string.
 
EcStringSizeT m_UtilityInputStringLocation
 Index for m_UtilityInputString.
 
EcToken m_UtilityAttributeName
 Temporary attribute name.
 
EcToken m_UtilityAttributeValue
 Temporary attribute value.
 
EcString m_UtilityNamespacePrefix
 Temporary namespace prefix.
 

Static Protected Attributes

static const EcToken m_theNullToken
 Temporary empty token (speeds up code)
 
static const EcString m_theNullString
 Temporary empty string (speeds up code)
 
static const EcString m_schemaInstanceNamespace
 The namespace string of the XML schema instance.
 

Detailed Description

An XML parser object that can read a single file.

Definition at line 20 of file ecXmlFileReader.h.

Member Enumeration Documentation

default namespace option

Enumerator
ELEMENT 

for element

ATTRIBUTE 

for attribute

Definition at line 258 of file ecXmlFileReader.h.

XML Reader Mode.

Enumerator
EOF_FOUND 

End of file.

START_TAG 

Start tag found.

END_TAG 

End tag found.

EMPTY_TAG 

Empty tag found.

CONTENT 

Content found.

ERROR_FOUND 

Error found.

Definition at line 24 of file ecXmlFileReader.h.

Constructor & Destructor Documentation

EcXmlFileReader::EcXmlFileReader ( const EcString filename,
std::istream &  stream 
)

Constructor with filename argument.

Parameters
filenameFile for reading
streamStream used for reading

Member Function Documentation

virtual const char* EcXmlFileReader::filename ( ) const
virtual

Get file name char * is used because that is what is needed by EcERROR and EcWARN

virtual const EcString& EcXmlFileReader::getChildrenAsString ( )
virtual

Get childen content as string.

Return values
Stringcontaining children
virtual const EcString& EcXmlFileReader::getComplexStartTagFast ( )
virtual

Get start tag (fast without error checking) Complex means tags with attributes

virtual EcBoolean EcXmlFileReader::getLineWithLineCount ( EcString input,
const char  delim,
EcBoolean  eatDelim 
)
protectedvirtual

Read file and count lines using getline()

Parameters
inputString containing data to be parsed
delimSearch delimiter
eatDelimRemove delimiter
Return values
Errorflag
virtual const EcString& EcXmlFileReader::getSimpleStartTagFast ( )
virtual

Get start tag (fast without error checking) Simple means tags without attributes

virtual EcBoolean EcXmlFileReader::isComment ( EcString input)
protectedvirtual

Is input a comment?

Parameters
inputString containing data to be analyzed
Return values
Flagindicating comment or not
virtual EcBoolean EcXmlFileReader::isWhiteSpace ( EcString input) const
protectedvirtual

Does input have data?

Parameters
inputString containing data to be analyzed
Return values
Flagindicating white space or not
virtual EcXmlFileReader::XML_READER_MODE EcXmlFileReader::nextEvent ( )
protectedvirtual

Get next input from stream.

Return values
xmlReadermode
virtual EcBoolean EcXmlFileReader::nextMatchingEndTag ( )
virtual

Continue reading to matching end tag for current element.

Return values
Errorflag
virtual EcBoolean EcXmlFileReader::nextMatchingEndTagWithErrorChecking ( )
virtual

Continue reading to matching end tag for current element.

Return values
Errorflag
virtual const EcString& EcXmlFileReader::nextQuotedToken ( EcString input) const
protectedvirtual

Get quoted token.

Parameters
inputString containing data to be parsed
Return values
quotedtoken
virtual const EcString& EcXmlFileReader::nextWord ( EcString input) const
protectedvirtual

Get next word from input string.

Parameters
inputString containing data to be parsed
Return values
word
virtual EcBoolean EcXmlFileReader::parseElementAndAttributes ( EcString tag)
protectedvirtual

Get element and attributes.

Parameters
tagString containing tag
Return values
Errorflag
virtual XML_READER_MODE EcXmlFileReader::readXml ( )
virtual

Executive for XML processing.

Return values
xmlReadermode
virtual void EcXmlFileReader::stripLeadingSlash ( EcString input) const
protectedvirtual

Strip leading slash from input.

Parameters
inputString containing data to be parsed
virtual void EcXmlFileReader::stripLeadingWhiteSpace ( EcString input) const
protectedvirtual

Strip leading white space.

Parameters
inputString containing data to be parsed
virtual void EcXmlFileReader::stripQuotes ( EcString input) const
protectedvirtual

Strip quotes from input.

Parameters
inputString containing data to be parsed
virtual void EcXmlFileReader::stripTrailingSlash ( EcString input) const
protectedvirtual

Strip trailing slash from input.

Parameters
inputString containing data to be parsed
virtual void EcXmlFileReader::stripTrailingWhiteSpace ( EcString input) const
protectedvirtual

Strip trailing white space.

Parameters
inputString containing data to be parsed
virtual void EcXmlFileReader::stripWhiteSpaceFromBounds ( EcString input) const
protectedvirtual

Strip white space from bounds.

Parameters
inputString containing data to be parsed
virtual const EcToken& EcXmlFileReader::swapNamespacePrefixWithUri ( EcToken input,
DEFAULT_NAMESPACE_OPTION  option = ELEMENT 
) const
protectedvirtual

Swap namespace prefix with URI.

Parameters
inputString tag needing the switch
optionTreat element and attribute default differently
virtual EcXmlFileReader::XML_READER_MODE EcXmlFileReader::tagType ( EcString tag)
protectedvirtual

What kind of tag?

Parameters
tagString containing tag
Return values
xmlReadermode
virtual void EcXmlFileReader::warnMessage ( const char *  message) const
protectedvirtual

Emits a warning message.

Parameters
messagea const char array
virtual const EcSizeT EcXmlFileReader::wordCount ( const EcString input) const
protectedvirtual

Get word count.

Parameters
inputString containing data to be parsed
Return values
numberof words

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.