Class XMLElement

Description

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

Located in /XMLElement.php (line 19)


	
			
Variable Summary
 mixed $attributes
 mixed $content
 mixed $tagname
 mixed $xmlns
 mixed $_parent
Method Summary
 XMLElement XMLElement (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, [ $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)
Variables
mixed $attributes (line 22)
mixed $content (line 23)
mixed $tagname (line 20)
mixed $xmlns (line 21)
mixed $_parent (line 24)
Methods
Constructor XMLElement (line 34)

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
AddSubTag (line 200)

Add a sub-element

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

Count the number of elements

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

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 121)

Accessor for the attributes

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

Accessor for the content

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

Return an array of elements matching the specified tag

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

Accessor for the full-namespaced tag name

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

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 93)

Accessor for the tag name

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

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 258)

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 228)

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 71)

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 84)

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

Documentation generated on Tue, 06 Oct 2009 09:31:51 -0700 by phpDocumentor 1.3.2