Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcDocumentElementVisitorConverter

Document::ezcDocumentElementVisitorConverter

Class ezcDocumentElementVisitorConverter

Basic converter which stores a list of handlers for each node in the docbook element tree. Those handlers will be executed for the elements, when found.

The handler can then handle the repective subtree.

Additional handlers may be added by the user to the converter class.

Source for this file: /Document/src/converters/element_visitor.php

ezcDocumentConverter
   |
   --ezcDocumentElementVisitorConverter
Version:   //autogen//

Descendants

Child Class Description
ezcDocumentEzXmlToDocbookConverter Converter for docbook to XDocbook with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.
ezcDocumentDocbookToWikiConverter Converter for docbook to Wiki with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.
ezcDocumentDocbookToRstConverter Converter for docbook to Rst with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.
ezcDocumentDocbookToHtmlConverter Converter for docbook to XHtml with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.
ezcDocumentDocbookToEzXmlConverter Converter for docbook to XEzXml with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.
ezcDocumentDocbookToOdtConverter Converter for docbook to ODT with a PHP callback based mechanism, for fast and easy PHP based extensible transformations.

Member Variables

protected string $defaultNamespace = 'docbook'
Deafult document namespace

If no namespace has been explicitely declared in the source document assume this as the defalt namespace.

protected SplObjectStorage $storage
Opject storage to check for reprocessing of DOMNodes, which may cause error which are hard to debug.
protected array $visitorElementHandler = array()
Element handlers

Element handlers for elements per namespace. The namespace names may be names, which might have document specific meaning, like "docbook" for all different docbook versions, or a namespace URI.

The handler is as an object of a class inheriting from ezcDocumentDocbookElementVisitorHandler.

Inherited Member Variables

From ezcDocumentConverter
protected ezcDocumentConverter::$options
protected ezcDocumentConverter::$properties

Method Summary

public ezcDocumentDocument convert( $source )
Convert documents between two formats
protected abstract ezcDocumentDocument createDocument( $content )
Create document from structure
protected abstract mixed initializeDocument( )
Initialize destination document
public void setElementHandler( $namespace , $element , $handler )
Set custom element handler
public mixed visitChildren( $node , $root )
Recursively visit children of a document node.
protected void visitElement( $node , $root )
Visit DOMElement nodes.
public mixed visitNode( $node , $root )
Visit a single document node
protected abstract mixed visitText( $text , $root )
Visit text node.

Inherited Methods

From ezcDocumentConverter
public ezcDocumentConverter ezcDocumentConverter::__construct()
Construct new document
public abstract ezcDocument ezcDocumentConverter::convert()
Convert documents between two formats
public array ezcDocumentConverter::getErrors()
Return list of errors occured during visiting the document.
public void ezcDocumentConverter::triggerError()
Trigger parser error

Methods

convert

ezcDocumentDocument convert( ezcDocumentDocbook $source )

Convert documents between two formats

Convert documents of the given type to the requested type.

Parameters:
Name Type Description
$source ezcDocumentDocbook
Redefinition of:
Method Description
ezcDocumentConverter::convert() Convert documents between two formats
Redefined in descendants as:
Method Description
ezcDocumentDocbookToOdtConverter::convert() Converts the given DocBook $source to an ODT document. 

createDocument

ezcDocumentDocument createDocument( mixed $content )

Create document from structure

Build a ezcDocumentDocument object from the structure created during the visiting process.

Parameters:
Name Type Description
$content mixed
Redefined in descendants as:
Method Description
ezcDocumentEzXmlToDocbookConverter::createDocument() Create document from structure 
ezcDocumentDocbookToWikiConverter::createDocument() Create document from structure 
ezcDocumentDocbookToRstConverter::createDocument() Create document from structure 
ezcDocumentDocbookToHtmlConverter::createDocument() Create document from structure 
ezcDocumentDocbookToEzXmlConverter::createDocument() Create document from structure 
ezcDocumentDocbookToOdtConverter::createDocument() Create document from structure 

initializeDocument

mixed initializeDocument( )

Initialize destination document

Initialize the structure which the destination document could be build with. This may be an initial DOMDocument with some default elements, or a string, or something else.

Redefined in descendants as:
Method Description
ezcDocumentEzXmlToDocbookConverter::initializeDocument() Initialize destination document 
ezcDocumentDocbookToWikiConverter::initializeDocument() Initialize destination document 
ezcDocumentDocbookToRstConverter::initializeDocument() Initialize destination document 
ezcDocumentDocbookToHtmlConverter::initializeDocument() Initialize destination document 
ezcDocumentDocbookToEzXmlConverter::initializeDocument() Initialize destination document 
ezcDocumentDocbookToOdtConverter::initializeDocument() Initialize destination document 

setElementHandler

void setElementHandler( string $namespace , string $element , ezcDocumentElementVisitorHandler $handler )

Set custom element handler

Set handler for yet unhandled element or overwrite the handler of an existing element.

Parameters:
Name Type Description
$namespace string
$element string
$handler ezcDocumentElementVisitorHandler

visitChildren

mixed visitChildren( $node , mixed $root )

Recursively visit children of a document node.

Recurse through the whole document tree and call the defined callbacks for node transformations, defined in the class property $visitorElementHandler.

Parameters:
Name Type Description
$node DOMNode
$root mixed

visitElement

void visitElement( $node , mixed $root )

Visit DOMElement nodes.

Parameters:
Name Type Description
$node DOMNode
$root mixed

visitNode

mixed visitNode( $node , mixed $root )

Visit a single document node

Visit a single document node and look up the correct visitor and us it to handle the node.

Parameters:
Name Type Description
$node DOMNode
$root mixed

visitText

mixed visitText( $text , mixed $root )

Visit text node.

Visit a text node in the source document and transform it to the destination result

Parameters:
Name Type Description
$text DOMText
$root mixed
Redefined in descendants as:
Method Description
ezcDocumentEzXmlToDocbookConverter::visitText() Visit text node. 
ezcDocumentDocbookToWikiConverter::visitText() Visit text node. 
ezcDocumentDocbookToRstConverter::visitText() Visit text node. 
ezcDocumentDocbookToHtmlConverter::visitText() Visit text node. 
ezcDocumentDocbookToEzXmlConverter::visitText() Visit text node. 
ezcDocumentDocbookToOdtConverter::visitText() Visit text node. 
Documentation generated by phpDocumentor 1.4.3