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// |
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. |
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. |
From ezcDocumentConverter | |
---|---|
protected |
ezcDocumentConverter::$options
|
protected |
ezcDocumentConverter::$properties
|
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. |
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 |
Convert documents between two formats
Convert documents of the given type to the requested type.
Name | Type | Description |
---|---|---|
$source |
ezcDocumentDocbook |
Method | Description |
---|---|
ezcDocumentConverter::convert() |
Convert documents between two formats |
Method | Description |
---|---|
ezcDocumentDocbookToOdtConverter::convert() |
Converts the given DocBook $source to an ODT document. |
Create document from structure
Build a ezcDocumentDocument object from the structure created during the visiting process.
Name | Type | Description |
---|---|---|
$content |
mixed |
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 |
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.
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 |
Set custom element handler
Set handler for yet unhandled element or overwrite the handler of an existing element.
Name | Type | Description |
---|---|---|
$namespace |
string | |
$element |
string | |
$handler |
ezcDocumentElementVisitorHandler |
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.
Name | Type | Description |
---|---|---|
$node |
DOMNode | |
$root |
mixed |
Visit DOMElement nodes.
Name | Type | Description |
---|---|---|
$node |
DOMNode | |
$root |
mixed |
Visit a single document node
Visit a single document node and look up the correct visitor and us it to handle the node.
Name | Type | Description |
---|---|---|
$node |
DOMNode | |
$root |
mixed |
Visit text node.
Visit a text node in the source document and transform it to the destination result
Name | Type | Description |
---|---|---|
$text |
DOMText | |
$root |
mixed |
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. |