Document
extends AbstractNode
in package
Dom class
Tags
Table of Contents
Constants
- ATOM = 'ATOM'
- Constant to use the XML doctype, Atom content-type
- HTML = 'HTML'
- Constant to use the HTML doctype
- RSS = 'RSS'
- Constant to use the XML doctype, RSS content-type
- XML = 'XML'
- Constant to use the XML doctype
Properties
- $charset : string
- Document charset
- $childNodes : array<string|int, mixed>
- Object child nodes
- $contentType : string
- Document content type
- $doctype : string
- Document type
- $doctypes : array<string|int, mixed>
- Document doctypes
- $indent : string|null
- Indentation for formatting purposes
- $output : string|null
- Child output
- $parent : AbstractNode|null
- Parent node
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Render Dom object to string
- addChild() : AbstractNode
- Add a child to the object
- addChildren() : AbstractNode
- Add children to the object
- getCharset() : string
- Return the document charset
- getChild() : Child|null
- Get the child nodes of the object
- getChildNodes() : array<string|int, mixed>
- Get the child nodes of the object (alias)
- getChildren() : array<string|int, mixed>
- Get the child nodes of the object
- getContentType() : string
- Return the document charset
- getDoctype() : string
- Return the document type.
- getIndent() : string
- Return the indent
- getParent() : AbstractNode|null
- Return the parent node
- hasChildNodes() : bool
- Get whether or not the child object has children (alias)
- hasChildren() : bool
- Get whether or not the child object has children
- removeChild() : void
- Remove all child nodes from the object
- removeChildren() : void
- Remove all child nodes from the object
- render() : string
- Render the document and its child elements
- setCharset() : Document
- Set the document charset
- setContentType() : Document
- Set the document charset
- setDoctype() : Document
- Set the document type
- setIndent() : AbstractNode
- Set the indent
- setParent() : AbstractNode
- Set the parent node
Constants
ATOM
Constant to use the XML doctype, Atom content-type
public
string
ATOM
= 'ATOM'
HTML
Constant to use the HTML doctype
public
string
HTML
= 'HTML'
RSS
Constant to use the XML doctype, RSS content-type
public
string
RSS
= 'RSS'
XML
Constant to use the XML doctype
public
string
XML
= 'XML'
Properties
$charset
Document charset
protected
string
$charset
= 'utf-8'
$childNodes
Object child nodes
protected
array<string|int, mixed>
$childNodes
= []
$contentType
Document content type
protected
string
$contentType
= 'application/xml'
$doctype
Document type
protected
string
$doctype
= 'XML'
$doctypes
Document doctypes
protected
static array<string|int, mixed>
$doctypes
= ['XML' => "<?xml version=\"1.0\" encoding=\"[{charset}]\"?>\n", 'HTML' => "<!DOCTYPE html>\n"]
$indent
Indentation for formatting purposes
protected
string|null
$indent
= null
$output
Child output
protected
string|null
$output
= null
$parent
Parent node
protected
AbstractNode|null
$parent
= null
Methods
__construct()
Constructor
public
__construct([string $doctype = 'XML' ][, Child|null $childNode = null ][, string|null $indent = null ]) : mixed
Instantiate the document object
Parameters
- $doctype : string = 'XML'
- $childNode : Child|null = null
- $indent : string|null = null
Tags
__toString()
Render Dom object to string
public
__toString() : string
Return values
stringaddChild()
Add a child to the object
public
addChild(Child $c) : AbstractNode
Parameters
- $c : Child
Tags
Return values
AbstractNodeaddChildren()
Add children to the object
public
addChildren(mixed $children) : AbstractNode
Parameters
- $children : mixed
Tags
Return values
AbstractNodegetCharset()
Return the document charset
public
getCharset() : string
Return values
stringgetChild()
Get the child nodes of the object
public
getChild(int $i) : Child|null
Parameters
- $i : int
Return values
Child|nullgetChildNodes()
Get the child nodes of the object (alias)
public
getChildNodes() : array<string|int, mixed>
Return values
array<string|int, mixed>getChildren()
Get the child nodes of the object
public
getChildren() : array<string|int, mixed>
Return values
array<string|int, mixed>getContentType()
Return the document charset
public
getContentType() : string
Return values
stringgetDoctype()
Return the document type.
public
getDoctype() : string
Return values
stringgetIndent()
Return the indent
public
getIndent() : string
Return values
stringgetParent()
Return the parent node
public
getParent() : AbstractNode|null
Return values
AbstractNode|nullhasChildNodes()
Get whether or not the child object has children (alias)
public
hasChildNodes() : bool
Return values
boolhasChildren()
Get whether or not the child object has children
public
hasChildren() : bool
Return values
boolremoveChild()
Remove all child nodes from the object
public
removeChild(int $i) : void
Parameters
- $i : int
removeChildren()
Remove all child nodes from the object
public
removeChildren() : void
render()
Render the document and its child elements
public
render() : string
Return values
stringsetCharset()
Set the document charset
public
setCharset(string $char) : Document
Parameters
- $char : string
Return values
DocumentsetContentType()
Set the document charset
public
setContentType(string $content) : Document
Parameters
- $content : string
Return values
DocumentsetDoctype()
Set the document type
public
setDoctype(string $doctype) : Document
Parameters
- $doctype : string
Tags
Return values
DocumentsetIndent()
Set the indent
public
setIndent(string $indent) : AbstractNode
Parameters
- $indent : string
Return values
AbstractNodesetParent()
Set the parent node
public
setParent(AbstractNode $parent) : AbstractNode
Parameters
- $parent : AbstractNode