Zend Framework  3.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Document Class Reference

Class used to initialize DomDocument from string, with proper verifications. More...

Public Member Functions

 __construct ($document=null, $type=null, $encoding=null)
 Constructor.
 
 getStringDocument ()
 Get raw set document.
 
 getType ()
 Get raw document type.
 
 getDomDocument ()
 Get DOMDocument generated from set raw document.
 
 getEncoding ()
 Get set document encoding.
 
 setEncoding ($encoding)
 Set raw document encoding for DOMDocument generation.
 
 getErrors ()
 Get DOMDocument generation errors.
 
 getXpathNamespaces ()
 Get Document's registered XPath namespaces.
 
 registerXpathNamespaces ($xpathNamespaces)
 Register XPath namespaces.
 
 getXpathPhpFunctions ()
 Get Document's registered XPath PHP Functions.
 
 registerXpathPhpFunctions ($xpathPhpFunctions=true)
 Register PHP Functions to use in internal DOMXPath.
 

Public Attributes

const DOC_HTML = 'DOC_HTML'
 #@+ Document types
 
const DOC_XHTML = 'DOC_XHTML'
 
const DOC_XML = 'DOC_XML'
 

Protected Member Functions

 setStringDocument ($document, $forcedType=null, $forcedEncoding=null)
 Set raw document.
 
 setType ($type)
 Set raw document type.
 
 setDomDocument (DOMDocument $domDocument)
 Set DOMDocument.
 
 setErrors ($errors)
 Set document errors from DOMDocument generation.
 
 getDomDocumentFromString ($stringDocument)
 Get DOMDocument from set raw document.
 

Protected Attributes

 $stringDocument
 
 $domDocument
 
 $type
 
 $errors = []
 
 $xpathNamespaces = []
 
 $xpathPhpFunctions
 
 $encoding
 

Detailed Description

Class used to initialize DomDocument from string, with proper verifications.

Constructor & Destructor Documentation

__construct (   $document = null,
  $type = null,
  $encoding = null 
)

Constructor.

Parameters
string | null$documentString containing the document
string | null$typeForce the document to be of a certain type, bypassing setStringDocument's detection
string | null$encodingEncoding for the document (used for DOMDocument generation)

Member Function Documentation

getDomDocument ( )

Get DOMDocument generated from set raw document.

Returns
DOMDocument
Exceptions
Exception\RuntimeExceptionIf cannot get DOMDocument; no document registered
getDomDocumentFromString (   $stringDocument)
protected

Get DOMDocument from set raw document.

Returns
DOMDocument
Exceptions
Exception\RuntimeException
getEncoding ( )

Get set document encoding.

Returns
string|null
getErrors ( )

Get DOMDocument generation errors.

Returns
array
getStringDocument ( )

Get raw set document.

Returns
string|null
getType ( )

Get raw document type.

Returns
string|null
getXpathNamespaces ( )

Get Document's registered XPath namespaces.

Returns
array
getXpathPhpFunctions ( )

Get Document's registered XPath PHP Functions.

Returns
string|null
registerXpathNamespaces (   $xpathNamespaces)

Register XPath namespaces.

Parameters
array$xpathNamespaces
Returns
void
registerXpathPhpFunctions (   $xpathPhpFunctions = true)

Register PHP Functions to use in internal DOMXPath.

Parameters
bool$xpathPhpFunctions
Returns
void
setDomDocument ( DOMDocument  $domDocument)
protected

Set DOMDocument.

Parameters
DOMDocument$domDocument
Returns
self
Deprecated:
setEncoding (   $encoding)

Set raw document encoding for DOMDocument generation.

Parameters
string | null$encoding
Returns
self
setErrors (   $errors)
protected

Set document errors from DOMDocument generation.

Parameters
array$errors
Returns
self
setStringDocument (   $document,
  $forcedType = null,
  $forcedEncoding = null 
)
protected

Set raw document.

Parameters
string | null$document
string | null$forcedTypeType for the provided document (see constants)
string | null$forcedEncodingEncoding for the provided document
Returns
self
setType (   $type)
protected

Set raw document type.

Parameters
string$type
Returns
self

Member Data Documentation

$domDocument
protected
$encoding
protected
$errors = []
protected
$stringDocument
protected
$type
protected
$xpathNamespaces = []
protected
$xpathPhpFunctions
protected
const DOC_HTML = 'DOC_HTML'

#@+ Document types

const DOC_XHTML = 'DOC_XHTML'
const DOC_XML = 'DOC_XML'