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

#include <elm/xom/dtd.h>

Public Member Functions

virtual ~Factory ()
 
virtual void begin (Element &element)
 
virtual void end (Element &element)
 
virtual void backtrack (Element &element)
 
virtual voidgetRef (Element &element)
 
virtual void getPCDATA (xom::String data)
 
virtual void patch (AbstractAttribute &attr, void *object, void *ref)
 
virtual voidgetPatchRef (AbstractAttribute &attr)
 
virtual void getAny (xom::Node *node)
 

Detailed Description

A factory is an interface with the DTD parser to let the application build its internal data structure the read XML elements.

Each time an element is found, the begin() function is called and the DTD attributes contains the element attribute values. When the element is exited, an end() is called. backtrack() is called if an error is found in the current element to let the application clean up its internal data structure.

If the XML identifier/reference is used, a pointer to the application internal data structure is obtained, when an ID attribute is found, by a call to getRef().

Constructor & Destructor Documentation

◆ ~Factory()

~Factory ( )
virtual

Member Function Documentation

◆ backtrack()

void backtrack ( Element element)
virtual

Called when the analysis of an element has failed. Its allocated resources can now be released. The element attributes may have their value overwritten in the use in other elements.

Parameters
elementFailed element.

◆ begin()

void begin ( Element element)
virtual

Called each time an element is entered. At this time, the attribute has been initialized and their value can be used.

Parameters
Enteredelement.

◆ end()

void end ( Element element)
virtual

Called each time an element is completed.

Parameters
elementCompleted element.

◆ getAny()

void getAny ( xom::Node node)
virtual

Function called when an ANY content is parsed. It is called for XML node composing the ANY content.

Parameters
nodeFound node.

Referenced by AnyContent::parse().

◆ getPatchRef()

void * getPatchRef ( AbstractAttribute attr)
virtual

This function is called to get a patch object for non-resolved forward references. The returned object will then be used to patch the missing reference when the function patch() is called.

The default implementation returns a null pointer.

Parameters
attrDTD reference attribute that is unresolved.
Returns
Object passed back at patch time.

◆ getPCDATA()

void getPCDATA ( xom::String  data)
virtual

Function called when the CDATA of an element is parsed, to pass the found text to the application.

Parameters
dataCDATA found in the current element.

Referenced by PCDATAContent::parse().

◆ getRef()

void * getRef ( Element element)
virtual

This function is called to get a reference on the current element. It is called after an begin() and if one of the attribute of the element is a reference.

Parameters
elementCurrent element.
Returns
Pointer identifying the current element.

◆ patch()

void patch ( AbstractAttribute attr,
void object,
void ref 
)
virtual

Function called to perform a backpatch. A backpatch is needed when a reference attribute is treated with a forward reference. As the reference cannot be processed immediately (the reference object is not already defined), this reference is recorded and a call to this function is performed as soon as the reference can be solved.

The default implementation does nothing.

Parameters
attrDTD attribute corresponding to the reference to patch.
objectObject obtained by a call to getPatchRef().
refSolved reference to patch.

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