Constructor - nothing fancy as yet.
XMLElement
XMLElement
(string $tagname, [mixed $content = false], [array $attributes = false], [array $xmlns = null])
-
string
$tagname: The tag name of the new element
-
mixed
$content: Either a string of content, or an array of sub-elements
-
array
$attributes: An array of attribute name/value pairs
-
array
$xmlns: An XML namespace specifier
Add a sub-element
void
AddSubTag
(object An &$v)
-
object An
&$v: XMLElement to be appended to the array of sub-elements
Count the number of elements
int
CountElements
()
Accessor for a single attribute
string
GetAttribute
(string $attr)
-
string
$attr: The name of the attribute.
Accessor for the attributes
array
GetAttributes
()
Accessor for the content
array
GetContent
()
Return an array of elements matching the specified tag
array
GetElements
( $tag, [ $recursive = false])
Accessor for the full-namespaced tag name
string
GetNSTag
()
Return an array of elements matching the specified path
array
GetPath
( $path)
Accessor for the tag name
string
GetTag
()
Add a new sub-element
objectref
&NewElement
(string $tagname, [mixed $content = false], [array $attributes = false], [ $xmlns = null])
-
string
$tagname: The tag name of the new element
-
mixed
$content: Either a string of content, or an array of sub-elements
-
array
$attributes: An array of attribute name/value pairs
-
$xmlns
Render the document tree into (nicely formatted) XML
void
Render
([int $indent = 0], [ $xmldef = ""], [ $nslist = null])
-
int
$indent: The indenting level for the pretty formatting of the element
-
$xmldef
-
$nslist
Render just the internal content
string
RenderContent
([ $indent = 0], [ $nslist = null])
Set an element attribute to a value
void
SetAttribute
(string $k, string $v)
-
string
$k: The attribute name
-
string
$v: The attribute value
Set the whole content to a value
void
SetContent
(mixed $v)
-
mixed
$v: The element content, which may be text, or an array of sub-elements