Documentation

Document extends AbstractNode
in package

Dom class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

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

license

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

version
4.0.0

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

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
throws
Exception

__toString()

Render Dom object to string

public __toString() : string
Return values
string

getCharset()

Return the document charset

public getCharset() : string
Return values
string

getChild()

Get the child nodes of the object

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

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

removeChildren()

Remove all child nodes from the object

public removeChildren() : 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

        
On this page

Search results