Documentation

Document extends AbstractNode
in package

Dom class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2023 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
3.3.0

Table of Contents

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
$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
Indentation for formatting purposes
$output  : string
Child output
$parent  : AbstractNode
Parent node
__construct()  : mixed
Constructor
__toString()  : string
Render Dom object to string
addChild()  : mixed
Add a child to the object
addChildren()  : mixed
Add children to the object
getCharset()  : string
Return the document charset
getChild()  : Child
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
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()  : mixed
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 $indent = null

Methods

__construct()

Constructor

public __construct([string $doctype = 'XML' ][, Child $childNode = null ][, string $indent = null ]) : mixed

Instantiate the document object

Parameters
$doctype : string = 'XML'
$childNode : Child = null
$indent : string = null
Return values
mixed

__toString()

Render Dom object to string

public __toString() : string
Return values
string

addChild()

Add a child to the object

public addChild(mixed $c) : mixed
Parameters
$c : mixed
Tags
throws
InvalidArgumentException
Return values
mixed

addChildren()

Add children to the object

public addChildren( $children) : mixed
Parameters
$children :
Tags
throws
Exception
Return values
mixed

getCharset()

Return the document charset

public getCharset() : string
Return values
string

getChild()

Get the child nodes of the object

public getChild(int $i) : Child
Parameters
$i : int
Return values
Child

getChildNodes()

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
string

getDoctype()

Return the document type.

public getDoctype() : string
Return values
string

getIndent()

Return the indent

public getIndent() : string
Return values
string

hasChildNodes()

Get whether or not the child object has children (alias)

public hasChildNodes() : bool
Return values
bool

hasChildren()

Get whether or not the child object has children

public hasChildren() : bool
Return values
bool

removeChild()

Remove all child nodes from the object

public removeChild(int $i) : void
Parameters
$i : int
Return values
void

removeChildren()

Remove all child nodes from the object

public removeChildren() : void
Return values
void

render()

Render the document and its child elements

public render() : string
Return values
string

setCharset()

Set the document charset

public setCharset(string $char) : Document
Parameters
$char : string
Return values
Document

setContentType()

Set the document charset

public setContentType(string $content) : Document
Parameters
$content : string
Return values
Document

setIndent()

Set the indent

public setIndent(string $indent) : mixed
Parameters
$indent : string
Return values
mixed

Search results