## Apache Zeta Components Manual :: Docs For Class ezcDocument

### Document::ezcDocument

### Class ezcDocument

A base class for document type handlers.

Source for this file: /Document/src/interfaces/document.php

### Implements interfaces:

- ezcDocumentErrorReporting

Version: | //autogen//

### Descendants

Child Class | Description
--- | ---
ezcDocumentWiki | Document handler for wiki text documents.
ezcDocumentBBCode | Document handler for BBCode text documents.
ezcDocumentPdf | Document handler for PDF documents.
ezcDocumentXmlBase | A base class for XML based document type handlers.
ezcDocumentRst | Document handler for RST text documents.

### Member Variables

protected array | `$errors = array()` Errors occured during the conversion process
protected ezcDocumentXmlOptions | `$options` XML document base options.
protected string | `$path = './'` Current document path, where the operations happen.

### Method Summary

public ezcDocument | `__construct( [ $options = null] )` Construct new document
public abstract void | `createFromDocbook( $document )` Create document from docbook document
public abstract ezcDocumentDocbook | `getAsDocbook( )` Return document compiled to the docbook format
public array | `getErrors( )` Return list of errors occured during visiting the document.
public string | `getPath( )` Get document base path
public void | `loadFile( $file )` Create document from file
public abstract void | `loadString( $string )` Create document from input string
public abstract string | `save( )` Return document as string
public void | `setPath( $path )` Set document base path
public void | `triggerError( $level , $message , [ $file = null] , [ $line = null] , [ $position = null] )` Trigger visitor error

### Methods

#### __construct

ezcDocument __construct( [ezcDocumentOptions $options = null] )

Construct new document

##### Parameters:

Name | Type | Description
--- | --- | ---
`$options` | ezcDocumentOptions |

#### createFromDocbook

void createFromDocbook( ezcDocumentDocbook $document )

Create document from docbook document

A document of the docbook format is provided and the internal document structure should be created out of this.

This method is required for all formats to have one central format, so that each format can be compiled into each other format using docbook as an intermediate format.

You may of course just call an existing converter for this conversion.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$document` | ezcDocumentDocbook |

##### Redefined in descendants as:

Method | Description
--- | ---
`ezcDocumentWiki::createFromDocbook()` | Create document from docbook document
`ezcDocumentConfluenceWiki::createFromDocbook()` | Create document from docbook document
`ezcDocumentDokuwikiWiki::createFromDocbook()` | Create document from docbook document
`ezcDocumentBBCode::createFromDocbook()` | Create document from docbook document
`ezcDocumentPdf::createFromDocbook()` | Create document from docbook document
`ezcDocumentXhtml::createFromDocbook()` | Create document from docbook document
`ezcDocumentOdt::createFromDocbook()` | Create document from docbook document
`ezcDocumentEzXml::createFromDocbook()` | Create document from docbook document
`ezcDocumentDocbook::createFromDocbook()` | Create document from docbook document
`ezcDocumentRst::createFromDocbook()` | Create document from docbook document

#### getAsDocbook

ezcDocumentDocbook getAsDocbook( )

Return document compiled to the docbook format

The internal document structure is compiled to the docbook format and the resulting docbook document is returned.

This method is required for all formats to have one central format, so that each format can be compiled into each other format using docbook as an intermediate format.

You may of course just call an existing converter for this conversion.

##### Redefined in descendants as:

Method | Description
--- | ---
`ezcDocumentWiki::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentBBCode::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentPdf::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentXhtml::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentOdt::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentEzXml::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentDocbook::getAsDocbook()` | Return document compiled to the docbook format
`ezcDocumentRst::getAsDocbook()` | Return document compiled to the docbook format

#### getErrors

array getErrors( )

Return list of errors occured during visiting the document.

May be an empty array, if on errors occured, or a list of ezcDocumentVisitException objects.

##### Implementation of:

Method | Description
--- | ---
`ezcDocumentErrorReporting::getErrors()` | Return list of errors occured during visiting the document.

#### getPath

string getPath( )

Get document base path

#### loadFile

void loadFile( string $file )

Create document from file

Create a document of the current type handler class and parse it into a usable internal structure. The default implementation just calls loadString(), but you may want to provide an optimized implementation.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$file` | string |

#### loadString

void loadString( string $string )

Create document from input string

Create a document of the current type handler class and parse it into a usable internal structure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$string` | string |

##### Redefined in descendants as:

Method | Description
--- | ---
`ezcDocumentWiki::loadString()` | Create document from input string
`ezcDocumentBBCode::loadString()` | Create document from input string
`ezcDocumentPdf::loadString()` | Create document from input string
`ezcDocumentXmlBase::loadString()` | Create document from input string
`ezcDocumentXhtml::loadString()` | Create document from input string
`ezcDocumentOdt::loadString()` | Create document from input string.
`ezcDocumentRst::loadString()` | Create document from input string

#### save

string save( )

Return document as string

Serialize the document to a string an return it.

##### Redefined in descendants as:

Method | Description
--- | ---
`ezcDocumentWiki::save()` | Return document as string
`ezcDocumentBBCode::save()` | Return document as string
`ezcDocumentPdf::save()` | Return document as string
`ezcDocumentXmlBase::save()` | Return document as string
`ezcDocumentXhtml::save()` | Return document as string
`ezcDocumentOdt::save()` | Return document as string
`ezcDocumentDocbook::save()` | Return document as string
`ezcDocumentRst::save()` | Return document as string

#### setPath

void setPath( string $path )

Set document base path

The base path will be used as a base for relative file inclusions in the document.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$path` | string |

#### triggerError

void triggerError( int $level , string $message , [string $file = null] , [int $line = null] , [int $position = null] )

Trigger visitor error

Emit a vistitor error, and convert it to an exception depending on the error reporting settings.

##### Parameters:

Name | Type | Description
--- | --- | ---
`$level` | int |
`$message` | string |
`$file` | string |
`$line` | int |
`$position` | int |

##### Implementation of:

Method | Description
--- | ---
`ezcDocumentErrorReporting::triggerError()` | Trigger parser error.

Documentation generated by phpDocumentor 1.4.3