Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Parser Class Reference

#include <elm/xom/dtd.h>

Public Types

typedef int mark_t
 

Public Member Functions

 Parser (Factory &factory, Element &element, t::uint32 flags=CROP)
 
bool doesCrop () const
 
Factoryfactory (void) const
 
Elementelement (void) const
 
Option< xom::Stringget (xom::String name) const
 
xom::ElementasElement () const
 
xom::Elementparent () const
 
bool isEmpty ()
 
void raise (const string &msg) const
 
void fail (const string &msg) const
 
void recordError ()
 
bool ended () const
 
xom::Nodecurrent (void) const
 
void next (void)
 
mark_t mark (void)
 
bool backtrack (mark_t m)
 
void begin (Element &element)
 
void end (bool success)
 
bool hasID (xom::String id) const
 
voidgetID (xom::String id) const
 
void addPost (AbstractAttribute *att)
 
void recordPatch (xom::String id, AbstractAttribute &attr)
 
void recordID (xom::String id, Element &element)
 
void parse (xom::Element *xelt)
 

Static Public Attributes

static const t::uint32 CROP = 0x01
 

Detailed Description

Parser for DTD module.

Member Typedef Documentation

◆ mark_t

typedef int mark_t

Constructor & Destructor Documentation

◆ Parser()

Parser ( Factory factory,
Element element,
t::uint32  flags = CROP 
)

Member Function Documentation

◆ addPost()

void addPost ( AbstractAttribute att)
inline

◆ asElement()

xom::Element * asElement ( ) const
inline

Get the current node as an element.

Returns
Current element.

Referenced by Element::parse().

◆ backtrack()

bool backtrack ( mark_t  mark)
inline

Back track to a previously marked position.

Parameters
markPosition mark to bcktrak to.

Referenced by Seq::parse(), and EmptyContent::parse().

◆ begin()

void begin ( Element element)

Begin the given element (and move to first child).

Parameters
elementBegun element.

Referenced by Element::parse().

◆ current()

xom::Node * current ( void  ) const
inline

Get the current XML node.

Returns
Current XML node.

References Node::node.

Referenced by Element::parse(), PCDATAContent::parse(), and AnyContent::parse().

◆ doesCrop()

bool doesCrop ( ) const
inline

Check the blank cropping option.

Returns
True if blank cropping is activated.

References elm::dtd::CROP.

◆ element()

Element & element ( void  ) const
inline

Get the current DTD element.

Returns
Current DTD element.

◆ end()

void end ( bool  success)

End the current element.

Referenced by Element::parse().

◆ ended()

bool ended ( ) const
inline

Test if the iteration on the children of the current parent element is ended.

Returns
True if the children iteration is at the end, fals else.

Referenced by Element::parse(), Optional::parse(), Seq::parse(), Repeat::parse(), EmptyContent::parse(), IgnoredContent::parse(), PCDATAContent::parse(), and AnyContent::parse().

◆ factory()

Factory & factory ( void  ) const
inline

Get the factory used by the parser.

Returns
Used factory.

Referenced by PCDATAContent::parse(), and AnyContent::parse().

◆ fail()

void fail ( const string msg) const
inline

Throw an exception for failure on the last recorded element.

Parameters
msgMessage of the exception.

◆ get()

Option< xom::String > get ( xom::String  name) const
inline

Get an attribute value in the current XML element. This function can only be called if the current XML node is an element.

Parameters
nameAttribute name.
Returns
Attribute value.

Referenced by AbstractAttribute::parse().

◆ getID()

void * getID ( xom::String  id) const
inline

Get the value associated with the given identifier.

Parameters
idLooked identifier.
Returns
Pointer corresponding to the identif if any, null else.

Referenced by RefAttribute< T >::process().

◆ hasID()

bool hasID ( xom::String  id) const
inline

Test if the given identifier is already assigned.

Returns
True if the identifier is assigned, false else.

Referenced by IDAttribute::process(), and RefAttribute< T >::process().

◆ isEmpty()

bool isEmpty ( )

Test if the current node is empty, that is only composed of spaces.

Returns
True if the current node is empty, false else.

References CString::length(), and Node::TEXT.

Referenced by EmptyContent::parse().

◆ mark()

mark_t mark ( void  )
inline

Get a mark on the current position.

Returns
Current position mark.

Referenced by Seq::parse(), and EmptyContent::parse().

◆ next()

void next ( void  )
inline

◆ parent()

xom::Element* parent ( ) const
inline

◆ parse()

void parse ( xom::Element xelt)

Parse the given XML element.

Parameters
xeltXML element to parse.
Exceptions
ExceptionIf there is an error.

References elm::_.

Referenced by Element::parse().

◆ raise()

void raise ( const string msg) const
inline

Throw an exception on the current node with the given message.

Parameters
msgMessage of the exception.

Referenced by IDAttribute::process(), and RefAttribute< T >::process().

◆ recordError()

void recordError ( )
inline

Record the current node as supporting an error.

Referenced by Element::parse().

◆ recordID()

void recordID ( xom::String  id,
Element element 
)

Declare a new identifier and possibly resolves several pending references.

Parameters
idSet ID.
elementElement where the ID is defined.

References elm::io::p().

Referenced by IDAttribute::postprocess().

◆ recordPatch()

void recordPatch ( xom::String  id,
AbstractAttribute attr 
)

Record a patch for a forward reference attribute that is unresolved.

Parameters
idForward reference identifier.
attrAttribute containing the forward reference identifier.

References elm::io::p().

Referenced by RefAttribute< T >::postprocess().

Member Data Documentation

◆ CROP

const t::uint32 CROP = 0x01
static

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