Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
elm::xom::NodeFactory Class Reference

#include <elm/xom/NodeFactory.h>

Public Member Functions

virtual ~NodeFactory (void)
 
virtual DocumentstartMakingDocument (void)
 
virtual ElementstartMakingElement (void)
 
virtual Nodes makeAttribute (void)
 
virtual Nodes makeComment (void)
 
virtual Nodes makeDocType (String rootElementName, String publicID, String systemID)
 
virtual Nodes makeProcessingInstruction (void)
 
virtual ElementmakeRootElement (void)
 
virtual Nodes makeText (void)
 
virtual Nodes finishMakingElement (Element *element)
 
virtual void finishMakingDocument (Document *document)
 
virtual AttributemakeAttribute (void *node)
 
virtual CommentmakeComment (void *node)
 
virtual DocumentmakeDocument (void *node)
 
virtual ProcessingInstruction * makeProcessingInstruction (void *node)
 
virtual ElementmakeElement (void *node)
 
virtual TextmakeText (void *node)
 

Static Public Attributes

static NodeFactory default_factory
 

Detailed Description

Used for building nodes during a load. Builders use a NodeFactory object to construct each Node object (Element, Text, Attribute, etc.) they add to the tree. The default implementation simply calls the relevant constructor, stuffs the resulting Node object in a length one Nodes object, and returns it.

Subclassing this class allows builders to produce instance of subclasses (for example, HTMLElement) instead of the base classes.

Subclasses can also filter content while building. For example, namespaces could be added to or changed on all elements. Comments could be deleted. Processing instructions can be changed into elements. An xinclude:include element could be replaced with the content it references. All such changes must be consistent with the usual rules of well-formedness. For example, the makeDocType() method should not return a list containing two DocType objects because an XML document can have at most one document type declaration. Nor should it return a list containing an element, because an element cannot appear in a document prolog. However, it could return a list containing any number of comments and processing instructions, and not more than one DocType object.

Constructor & Destructor Documentation

elm::xom::NodeFactory::~NodeFactory ( void  )
virtual

Member Function Documentation

void elm::xom::NodeFactory::finishMakingDocument ( Document document)
virtual

Signals the end of a document. The default implementation of this method does nothing. The builder does not call this method if an exception is thrown while building a document.

Parameters
documentthe completed Document
Nodes elm::xom::NodeFactory::finishMakingElement ( Element element)
virtual
Nodes elm::xom::NodeFactory::makeAttribute ( void  )
virtual
Attribute * elm::xom::NodeFactory::makeAttribute ( void *  node)
virtual

Build an attribute from an XML node.

Parameters
nodeXML node.
Returns
Built attribute.
Nodes elm::xom::NodeFactory::makeComment ( void  )
virtual

Referenced by elm::xom::Node::make().

Comment * elm::xom::NodeFactory::makeComment ( void *  node)
virtual

Build a comment from an XML node.

Parameters
nodeXML node.
Returns
Built comment.
Nodes elm::xom::NodeFactory::makeDocType ( xom::String  rootElementName,
xom::String  publicID,
xom::String  systemID 
)
virtual
Document * elm::xom::NodeFactory::makeDocument ( void *  node)
virtual

Build a document from an input stream.

Parameters
nodeNode used by the parser.

Referenced by elm::xom::Builder::build().

Element * elm::xom::NodeFactory::makeElement ( void *  node)
virtual

Build an element from its low-level reference.

Parameters
nodeLow-level node reference.

Referenced by elm::xom::Node::make().

Nodes elm::xom::NodeFactory::makeProcessingInstruction ( void  )
virtual
ProcessingInstruction * elm::xom::NodeFactory::makeProcessingInstruction ( void *  node)
virtual

Build a comment from an XML node.

Parameters
nodeXML node.
Returns
Built comment.
Element * elm::xom::NodeFactory::makeRootElement ( void  )
virtual
Nodes elm::xom::NodeFactory::makeText ( void  )
virtual

Referenced by elm::xom::Node::make().

Text * elm::xom::NodeFactory::makeText ( void *  node)
virtual

Build a text from its low-level node reference.

Parameters
nodeLow-level node reference.
Document * elm::xom::NodeFactory::startMakingDocument ( void  )
virtual

Creates a new Document object. The root element of this document is initially set to <root xmlns="http://www.xom.nu/fakeRoot">. This is only temporary. As soon as the real root element's start-tag is read, this element is replaced by the real root. This fake root should never be exposed.

The builder calls this method at the beginning of each document, before it calls any other method in this class. Thus this is a useful place to perform per-document initialization tasks.

Subclasses may change the root element, content, or other characteristics of the document returned. However, this method must not return null or the builder will throw a ParsingException.

Returns
the newly created Document
Element * elm::xom::NodeFactory::startMakingElement ( void  )
virtual

Member Data Documentation

NodeFactory elm::xom::NodeFactory::default_factory
static

Default node factory.


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