XmlDocument

Extends \Joomla\CMS\Document\Document

XmlDocument class, provides an easy interface to parse and display XML output

since

1.7.0

Methods

__construct

Class constructor.

__construct(array $options = array()) 
inherited
since

1.7.0

Arguments

$options

arrayAssociative array of options

_getLineEnd

Returns the lineEnd

_getLineEnd() : string
inherited
since

1.7.0

Response

string

_getTab

Returns a string containing the unit for indenting HTML

_getTab() : string
inherited
since

1.7.0

Response

string

addScript

Adds a linked script to the page

addScript(string $url, array $options = array(), array $attribs = array()) : \Joomla\CMS\Document\Document
inherited deprecated
since

1.7.0

deprecated

4.0 The (url, mime, defer, async) method signature is deprecated, use (url, options, attributes) instead.

Arguments

$url

stringURL to the linked script.

$options

arrayArray of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9')

$attribs

arrayArray of attributes. Example: array('id' => 'scriptid', 'async' => 'async', 'data-test' => 1)

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addScriptDeclaration

Adds a script to the page

addScriptDeclaration(string $content, string $type = 'text/javascript') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$content

stringScript

$type

stringScripting mime (defaults to 'text/javascript')

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addScriptOptions

Add option for script

addScriptOptions(string $key, mixed $options, boolean $merge = true) : \Joomla\CMS\Document\Document
inherited
since

3.5

Arguments

$key

stringName in Storage

$options

mixedScrip options as array or string

$merge

booleanWhether merge with existing (true) or replace (false)

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addScriptVersion

Adds a linked script to the page with a version to allow to flush it. Ex: myscript.js?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning

addScriptVersion(string $url, array $options = array(), array $attribs = array()) : \Joomla\CMS\Document\Document
inherited deprecated
since

3.2

deprecated

4.0 This method is deprecated, use addScript(url, options, attributes) instead.

Arguments

$url

stringURL to the linked script.

$options

arrayArray of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9')

$attribs

arrayArray of attributes. Example: array('id' => 'scriptid', 'async' => 'async', 'data-test' => 1)

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addStyleDeclaration

Adds a stylesheet declaration to the page

addStyleDeclaration(string $content, string $type = 'text/css') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$content

stringStyle declarations

$type

stringType of stylesheet (defaults to 'text/css')

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addStyleSheet

Adds a linked stylesheet to the page

addStyleSheet(string $url, array $options = array(), array $attribs = array()) : \Joomla\CMS\Document\Document
inherited deprecated
since

1.7.0

deprecated

4.0 The (url, mime, media, attribs) method signature is deprecated, use (url, options, attributes) instead.

Arguments

$url

stringURL to the linked style sheet

$options

arrayArray of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9')

$attribs

arrayArray of attributes. Example: array('id' => 'stylesheet', 'data-test' => 1)

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

addStyleSheetVersion

Adds a linked stylesheet version to the page. Ex: template.css?54771616b5bceae9df03c6173babf11d If not specified Joomla! automatically handles versioning

addStyleSheetVersion(string $url, array $options = array(), array $attribs = array()) : \Joomla\CMS\Document\Document
inherited deprecated
since

3.2

deprecated

4.0 This method is deprecated, use addStyleSheet(url, options, attributes) instead.

Arguments

$url

stringURL to the linked style sheet

$options

arrayArray of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9')

$attribs

arrayArray of attributes. Example: array('id' => 'stylesheet', 'data-test' => 1)

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

getBase

Return the base URI of the document.

getBase() : string
inherited
since

1.7.0

Response

string

getBuffer

Get the contents of the document buffer

getBuffer() : mixed
inherited
since

1.7.0

Response

mixed

getCharset

Returns the document charset encoding.

getCharset() : string
inherited
since

1.7.0

Response

string

getDescription

Return the description of the document.

getDescription() : string
inherited
since

1.7.0

Response

string

getDirection

Returns the document direction declaration.

getDirection() : string
inherited
since

1.7.0

Response

string

getGenerator

Returns the document generator

getGenerator() : string
inherited
since

1.7.0

Response

string

getInstance

Returns the global Document object, only creating it if it doesn't already exist.

getInstance(string $type = 'html', array $attributes = array()) : object
inherited static
since

1.7.0

Arguments

$type

stringThe document type to instantiate

$attributes

arrayArray of attributes

Response

objectThe document object.

getLanguage

Returns the document language.

getLanguage() : string
inherited
since

1.7.0

Response

string

getMediaVersion

Return the media version

getMediaVersion() : string
inherited
since

3.2

Response

string

getMetaData

Gets a meta tag.

getMetaData(string $name, string $attribute = 'name') : string
inherited
since

1.7.0

Arguments

$name

stringName of the meta HTML tag

$attribute

stringAttribute to use in the meta HTML tag

Response

string

getMimeEncoding

Return the document MIME encoding that is sent to the browser.

getMimeEncoding() : string
inherited
since

1.7.0

Response

string

getModifiedDate

Returns the document modified date

getModifiedDate() : string|\Joomla\CMS\Date\Date
inherited
since

1.7.0

Response

string|\Joomla\CMS\Date\Date

getName

Returns the document name

getName() : string
since

1.7.0

Response

string

getScriptOptions

Get script(s) options

getScriptOptions(string $key = null) : array
inherited
since

3.5

Arguments

$key

stringName in Storage

Response

arrayOptions for given $key, or all script options

getTitle

Return the title of the document.

getTitle() : string
inherited
since

1.7.0

Response

string

getType

Returns the document type

getType() : string
inherited
since

1.7.0

Response

string

isDownload

Check if this document is intended for download

isDownload() : string
since

3.9.0

Response

string

loadRenderer

Load a renderer

loadRenderer(string $type) : \Joomla\CMS\Document\DocumentRenderer
inherited
since

1.7.0

throws

\RuntimeException

Arguments

$type

stringThe renderer type

Response

\Joomla\CMS\Document\DocumentRenderer

parse

Parses the document and prepares the buffers

parse(array $params = array()) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$params

arrayThe array of parameters

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

render

Outputs the document

render(boolean $cache = false, array $params = array()) : void
inherited
since

1.7.0

Arguments

$cache

booleanIf true, cache the output

$params

arrayAssociative array of attributes

setBase

Sets the base URI of the document

setBase(string $base) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$base

stringThe base URI to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setBuffer

Set the contents of the document buffer

setBuffer(string $content, array $options = array()) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$content

stringThe content to be set in the buffer.

$options

arrayArray of optional elements.

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setCharset

Sets the document charset

setCharset(string $type = 'utf-8') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$type

stringCharset encoding string

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setDescription

Sets the description of the document

setDescription(string $description) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$description

stringThe description to set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setDirection

Sets the global document direction declaration. Default is left-to-right (ltr).

setDirection(string $dir = 'ltr') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$dir

stringThe language direction to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setDownload

Sets the document's download state

setDownload(boolean $download = false) : \Joomla\CMS\Document\XmlDocument
since

3.9.0

Arguments

$download

booleanIf true, this document will be downloaded; if false, this document will be displayed inline

Response

\Joomla\CMS\Document\XmlDocumentinstance of $this to allow chaining

setGenerator

Sets the document generator

setGenerator(string $generator) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$generator

stringThe generator to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setLanguage

Sets the global document language declaration. Default is English (en-gb).

setLanguage(string $lang = 'en-gb') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$lang

stringThe language to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setLineEnd

Sets the line end style to Windows, Mac, Unix or a custom string.

setLineEnd(string $style) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$style

string"win", "mac", "unix" or custom string.

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setMediaVersion

Set the assets version

setMediaVersion(string $mediaVersion) : \Joomla\CMS\Document\Document
inherited
since

3.2

Arguments

$mediaVersion

stringMedia version to use

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setMetaData

Sets or alters a meta tag.

setMetaData(string $name, mixed $content, string $attribute = 'name') : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$name

stringName of the meta HTML tag

$content

mixedValue of the meta HTML tag as array or string

$attribute

stringAttribute to use in the meta HTML tag

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setMimeEncoding

Sets the document MIME encoding that is sent to the browser.

setMimeEncoding(string $type = 'text/html', boolean $sync = true) : \Joomla\CMS\Document\Document
inherited

This usually will be text/html because most browsers cannot yet accept the proper mime settings for XHTML: application/xhtml+xml and to a lesser extent application/xml and text/xml. See the W3C note (http://www.w3.org/TR/xhtml-media-types/) for more details.

since

1.7.0

link

http://www.w3.org/TR/xhtml-media-types

Arguments

$type

stringThe document type to be sent

$sync

booleanShould the type be synced with HTML?

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setModifiedDate

Sets the document modified date

setModifiedDate(string|\Joomla\CMS\Date\Date $date) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

throws

\InvalidArgumentException

Arguments

$date

string|\Joomla\CMS\Date\DateThe date to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setName

Sets the document name

setName(string $name = 'joomla') : \Joomla\CMS\Document\XmlDocument
since

1.7.0

Arguments

$name

stringDocument name

Response

\Joomla\CMS\Document\XmlDocumentinstance of $this to allow chaining

setTab

Sets the string used to indent HTML

setTab(string $string) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$string

stringString used to indent ("\11", "\t", ' ', etc.).

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setTitle

Sets the title of the document

setTitle(string $title) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$title

stringThe title to be set

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

setType

Set the document type

setType(string $type) : \Joomla\CMS\Document\Document
inherited
since

1.7.0

Arguments

$type

stringType document is to set to

Response

\Joomla\CMS\Document\Documentinstance of $this to allow chaining

Properties

name

Document name

since

3.0.0

Type(s)

string

isDownload

Flag indicating the document should be downloaded (Content-Disposition = attachment) versus displayed inline

since

3.9.0

Type(s)

boolean

title

Document title

inherited
since

1.7.0

Type(s)

string

description

Document description

inherited
since

1.7.0

Type(s)

string

base

Document base URL

inherited
since

1.7.0

Type(s)

string

language

Contains the document language setting

inherited
since

1.7.0

Type(s)

string

direction

Contains the document direction setting

inherited
since

1.7.0

Type(s)

string

_generator

Document generator

inherited
since

1.7.0

Type(s)

string

_mdate

Document modified date

inherited
since

1.7.0

Type(s)

string|\Joomla\CMS\Date\Date

_tab

Tab string

inherited
since

1.7.0

Type(s)

string

_lineEnd

Contains the line end string

inherited
since

1.7.0

Type(s)

string

_charset

Contains the character encoding string

inherited
since

1.7.0

Type(s)

string

_mime

Document mime type

inherited
since

1.7.0

Type(s)

string

_namespace

Document namespace

inherited
since

1.7.0

Type(s)

string

_profile

Document profile

inherited
since

1.7.0

Type(s)

string

_scripts

Array of linked scripts

inherited
since

1.7.0

Type(s)

array

_script

Array of scripts placed in the header

inherited
since

1.7.0

Type(s)

array

scriptOptions

Array of scripts options

inherited

Type(s)

array

_styleSheets

Array of linked style sheets

inherited
since

1.7.0

Type(s)

array

_style

Array of included style declarations

inherited
since

1.7.0

Type(s)

array

_metaTags

Array of meta tags

inherited
since

1.7.0

Type(s)

array

_engine

The rendering engine

inherited
since

1.7.0

Type(s)

object

_type

The document type

inherited
since

1.7.0

Type(s)

string

_buffer

Array of buffered output

inherited static
since

1.7.0

Type(s)

mixed

instances

Document instances container.

inherited static
since

1.7.3

Type(s)

array

mediaVersion

Media version added to assets

inherited
since

3.2

Type(s)

string