Class XMLElement

Description

A class for XML elements which may have attributes, or contain other XML sub-elements

Located in /XMLElement.php (line 20)


	
			
Variable Summary
 mixed $attributes
 mixed $content
 mixed $tagname
 mixed $xmlns
 mixed $_parent
Method Summary
 XMLElement __construct (string $tagname, [mixed $content = false], [array $attributes = false], [array $xmlns = null])
 void AddSubTag (object An &$v)
 int CountElements ()
 string GetAttribute (string $attr)
 array GetAttributes ()
 array GetContent ()
 array GetElements ([ $tag = null], [ $recursive = false])
 string GetNSTag ()
 array GetPath ( $path)
 string GetTag ()
 objectref &NewElement (string $tagname, [mixed $content = false], [array $attributes = false], [ $xmlns = null])
 void Render ([int $indent = 0], [ $xmldef = ""], [ $nslist = null])
 string RenderContent ([ $indent = 0], [ $nslist = null])
 void SetAttribute (string $k, string $v)
 void SetContent (mixed $v)
 void __tostring ()
Variables
mixed $attributes (line 23)
  • access: protected
mixed $content (line 24)
  • access: protected
mixed $tagname (line 21)
  • access: protected
mixed $xmlns (line 22)
  • access: protected
mixed $_parent (line 25)
  • access: protected
Methods
Constructor __construct (line 35)

Constructor - nothing fancy as yet.

XMLElement __construct (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
AddSubTag (line 206)

Add a sub-element

void AddSubTag (object An &$v)
  • object An &$v: XMLElement to be appended to the array of sub-elements
CountElements (line 59)

Count the number of elements

  • return: The number of elements
int CountElements ()
GetAttribute (line 112)

Accessor for a single attribute

  • return: The value of that attribute of the element
string GetAttribute (string $attr)
  • string $attr: The name of the attribute.
GetAttributes (line 123)

Accessor for the attributes

  • return: The attributes of this element
array GetAttributes ()
GetContent (line 132)

Accessor for the content

  • return: The content of this element
array GetContent ()
GetElements (line 142)

Return an array of elements matching the specified tag, or all elements if no tag is supplied.

Unlike GetContent() this will always return an array.

  • return: The XMLElements within the tree which match this tag
array GetElements ([ $tag = null], [ $recursive = false])
  • $tag
  • $recursive
GetNSTag (line 103)

Accessor for the full-namespaced tag name

  • return: The tag name of the element, prefixed by the namespace
string GetNSTag ()
GetPath (line 166)

Return an array of elements matching the specified path

  • return: The XMLElements within the tree which match this tag
array GetPath ( $path)
  • $path
GetTag (line 94)

Accessor for the tag name

  • return: The tag name of the element
string GetTag ()
NewElement (line 221)

Add a new sub-element

  • return: A reference to the new XMLElement
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 (line 264)

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
RenderContent (line 234)

Render just the internal content

  • return: The content of this element, as a string without this element wrapping it.
string RenderContent ([ $indent = 0], [ $nslist = null])
  • $indent
  • $nslist
SetAttribute (line 72)

Set an element attribute to a value

void SetAttribute (string $k, string $v)
  • string $k: The attribute name
  • string $v: The attribute value
SetContent (line 85)

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
__tostring (line 302)
void __tostring ()

Documentation generated on Thu, 15 Apr 2010 20:23:07 +1200 by phpDocumentor 1.3.2