textwolf  0.2
Classes | Public Types | Static Public Member Functions | List of all members
textwolf::XMLScannerBase Class Reference

XML scanner base class for things common for all XML scanners. More...

#include <xmlscanner.hpp>

Inheritance diagram for textwolf::XMLScannerBase:
textwolf::XMLScanner< InputIterator, InputCharSet_, OutputCharSet_, OutputBuffer_ >

Classes

class  IsContentCharMap
 Defines the set of content token characters. More...
 
class  IsDQStringCharMap
 Defines the set characters belonging to a double quoted string. More...
 
class  IsSQStringCharMap
 Defines the set characters belonging to a single quoted string. More...
 
class  IsTagCharMap
 Defines the set of tag characters. More...
 
class  IsWordCharMap
 Defines the set of content word characters (for tokenization) More...
 
class  Statemachine
 XML scanner state machine implementation. More...
 

Public Types

enum  ElementType {
  None, ErrorOccurred, HeaderStart, HeaderAttribName,
  HeaderAttribValue, HeaderEnd, DocAttribValue, DocAttribEnd,
  TagAttribName, TagAttribValue, OpenTag, CloseTag,
  CloseTagIm, Content, Exit
}
 Enumeration of XML element types returned by an XML scanner. More...
 
enum  { NofElementTypes =Exit+1 }
 
enum  Error {
  Ok, ErrIllegalDocumentAttributeDef, ErrExpectedOpenTag, ErrExpectedXMLTag,
  ErrUnexpectedEndOfText, ErrSyntaxToken, ErrStringNotTerminated, ErrUndefinedCharacterEntity,
  ErrExpectedTagEnd, ErrExpectedEqual, ErrExpectedTagAttribute, ErrExpectedCDATATag,
  ErrInternal, ErrUnexpectedEndOfInput, ErrExpectedEndOfLine, ErrExpectedDash2
}
 Enumeration of XML scanner error codes. More...
 
enum  STMState {
  START, STARTTAG, XTAG, PITAG,
  PITAGEND, XTAGEND, XTAGDONE, XTAGAISK,
  XTAGANAM, XTAGAESK, XTAGAVSK, XTAGAVID,
  XTAGAVSQ, XTAGAVDQ, XTAGAVQE, DOCSTART,
  CONTENT, TOKEN, SEEKTOK, XMLTAG,
  OPENTAG, CLOSETAG, TAGCLSK, TAGAISK,
  TAGANAM, TAGAESK, TAGAVSK, TAGAVID,
  TAGAVSQ, TAGAVDQ, TAGAVQE, TAGCLIM,
  ENTITYSL, ENTITY, ENTITYE, ENTITYID,
  ENTITYSQ, ENTITYDQ, ENTITYLC, COMDASH2,
  COMSEEKE, COMENDD2, COMENDCL, CDATA,
  CDATA1, CDATA2, CDATA3, EXIT
}
 Enumeration of states of the XML scanner state machine. More...
 
enum  STMAction {
  Return, ReturnWord, ReturnContent, ReturnIdentifier,
  ReturnSQString, ReturnDQString, ExpectIdentifierXML, ExpectIdentifierCDATA,
  ReturnEOF, NofSTMActions = 9
}
 Enumeration of actions in the XML scanner state machine. More...
 
typedef CharMap< bool, false,
NofControlCharacter
IsTokenCharMap
 Forms a set of characters by assigning (true/false) to the whole domain. More...
 

Static Public Member Functions

static const char * getElementTypeName (ElementType ee)
 Get the XML element type as string. More...
 
static const char * getErrorString (Error ee)
 Get the error code as string. More...
 
static const char * getStateString (STMState s)
 Get the scanner state machine state as string. More...
 
static const char * getActionString (STMAction a)
 Get the scanner state machine action as string. More...
 

Detailed Description

XML scanner base class for things common for all XML scanners.

Member Typedef Documentation

Forms a set of characters by assigning (true/false) to the whole domain.

Member Enumeration Documentation

anonymous enum
Enumerator
NofElementTypes 

number of XML element types defined

Enumeration of XML element types returned by an XML scanner.

Enumerator
None 

[0] empty (NULL)

ErrorOccurred 

[1] XML scanning error error reported

HeaderStart 

[2] open XML header tag

HeaderAttribName 

[3] tag attribute name in the XML header

HeaderAttribValue 

[4] tag attribute value in the XML header

HeaderEnd 

[5] end of XML header event (after parsing '?>')

DocAttribValue 

[6] document attribute value in a DOCTYPE or ENTITY definition

DocAttribEnd 

[7] end of a document attribute definition <! .. !>

TagAttribName 

[8] tag attribute name (e.g. "id" in <person id='5'>

TagAttribValue 

[9] tag attribute value (e.g. "5" in <person id='5'>

OpenTag 

[10] open tag (e.g. "bla" for "&lt;bla...")

CloseTag 

[11] close tag (e.g. "bla" for "&lt;/bla&gt;")

CloseTagIm 

[12] immediate close tag (e.g. "bla" for "&lt;bla /&gt;")

Content 

[13] content element string (separated by spaces or end of line)

Exit 

[14] end of document

Enumeration of XML scanner error codes.

Enumerator
Ok 

no error, everything is OK

ErrIllegalDocumentAttributeDef 

error in document attribute or entity definition

ErrExpectedOpenTag 

expected an open tag in this state

ErrExpectedXMLTag 

expected an <?xml tag in this state

ErrUnexpectedEndOfText 

unexpected end of text in the middle of the XML definition

ErrSyntaxToken 

a specific string expected as token in XML but does not match

ErrStringNotTerminated 

attribute string in XML not terminated on the same line

ErrUndefinedCharacterEntity 

named entity is not defined in the entity map

ErrExpectedTagEnd 

expected end of tag

ErrExpectedEqual 

expected equal in tag attribute definition

ErrExpectedTagAttribute 

expected tag attribute

ErrExpectedCDATATag 

expected CDATA tag definition

ErrInternal 

internal error (textwolf implementation error)

ErrUnexpectedEndOfInput 

unexpected end of input stream

ErrExpectedEndOfLine 

expected mandatory end of line (after XML header)

ErrExpectedDash2 

expected second '-' after '<!-' to start an XML comment as ''

Enumeration of actions in the XML scanner state machine.

Enumerator
Return 
ReturnWord 
ReturnContent 
ReturnIdentifier 
ReturnSQString 
ReturnDQString 
ExpectIdentifierXML 
ExpectIdentifierCDATA 
ReturnEOF 
NofSTMActions 

Enumeration of states of the XML scanner state machine.

Enumerator
START 
STARTTAG 
XTAG 
PITAG 
PITAGEND 
XTAGEND 
XTAGDONE 
XTAGAISK 
XTAGANAM 
XTAGAESK 
XTAGAVSK 
XTAGAVID 
XTAGAVSQ 
XTAGAVDQ 
XTAGAVQE 
DOCSTART 
CONTENT 
TOKEN 
SEEKTOK 
XMLTAG 
OPENTAG 
CLOSETAG 
TAGCLSK 
TAGAISK 
TAGANAM 
TAGAESK 
TAGAVSK 
TAGAVID 
TAGAVSQ 
TAGAVDQ 
TAGAVQE 
TAGCLIM 
ENTITYSL 
ENTITY 
ENTITYE 
ENTITYID 
ENTITYSQ 
ENTITYDQ 
ENTITYLC 
COMDASH2 
COMSEEKE 
COMENDD2 
COMENDCL 
CDATA 
CDATA1 
CDATA2 
CDATA3 
EXIT 

Member Function Documentation

static const char* textwolf::XMLScannerBase::getActionString ( STMAction  a)
inlinestatic

Get the scanner state machine action as string.

Parameters
[in]athe action
Returns
the action as string
static const char* textwolf::XMLScannerBase::getElementTypeName ( ElementType  ee)
inlinestatic

Get the XML element type as string.

Parameters
[in]eeXML element type
Returns
XML element type as string
static const char* textwolf::XMLScannerBase::getErrorString ( Error  ee)
inlinestatic

Get the error code as string.

Parameters
[in]eeerror code
Returns
the error code as string
static const char* textwolf::XMLScannerBase::getStateString ( STMState  s)
inlinestatic

Get the scanner state machine state as string.

Parameters
[in]sthe state
Returns
the state as string

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