Dotclear 2.25
Loading...
Searching...
No Matches
xmlTag Class Reference

Public Member Functions

 __construct (?string $name=null, $content=null)
 
 __set (string $name, mixed $value)
 
 __call (string $name, array $args)
 
 CDATA (string $value)
 
 insertAttr (string $name, mixed $value)
 
 insertNode ($node=null)
 
 toXML (bool $prolog=false, string $encoding='UTF-8')
 

Detailed Description

XML Tree

Constructor & Destructor Documentation

◆ __construct()

__construct ( ?string  $name = null,
  $content = null 
)

Constructor

Creates the root XML tag named $name. If content is given, it will be appended to root tag with insertNode()

Parameters
string$nameTag name
mixed$contentTag content

References insertNode().

Member Function Documentation

◆ __set()

__set ( string  $name,
mixed  $value 
)

Add Attribute

Magic __set method to add an attribute.

Parameters
string$nameAttribute name
mixed$valueAttribute value
See also
insertAttr()

References insertAttr().

◆ __call()

__call ( string  $name,
array  $args 
)

Add a tag

This magic __call method appends a tag to XML tree.

Parameters
string$nameTag name
array$argsFunction arguments, the first one would be tag content

References insertNode().

◆ CDATA()

CDATA ( string  $value)

Add CDATA

Appends CDATA to current tag.

Parameters
string$valueTag CDATA content

References insertNode().

◆ insertAttr()

insertAttr ( string  $name,
mixed  $value 
)

Add Attribute

This method adds an attribute to current tag.

Parameters
string$nameAttribute name
mixed$valueAttribute value
See also
insertAttr()

Referenced by __set().

◆ insertNode()

insertNode (   $node = null)

Insert Node

This method adds a new XML node. Node could be a instance of xmlTag, an array of valid values, a boolean or a string.

Parameters
xmlTag | array | bool | string$nodeNode value

Referenced by __call(), __construct(), and CDATA().

◆ toXML()

toXML ( bool  $prolog = false,
string  $encoding = 'UTF-8' 
)

XML Result

Returns a string with XML content.

Parameters
bool$prologAppend prolog to result
string$encodingResult charset
Returns
string

The documentation for this class was generated from the following file: