Overview

Packages

  • awl
    • AuthPlugin
    • AwlDatabase
    • Browser
    • classEditor
    • DataEntry
    • DataUpdate
    • EMail
    • iCalendar
    • MenuSet
    • PgQuery
    • Session
    • Translation
    • User
    • Utilities
    • Validation
    • vCalendar
    • vComponent
    • XMLDocument
    • XMLElement
  • None

Classes

  • XMLElement

Functions

  • BuildXMLTree
  • Overview
  • Package
  • Class

Class XMLElement

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

Package: awl\XMLElement
Copyright: Catalyst .Net Ltd, Morphoss Ltd http://www.morphoss.com/
License: GNU LGPL version 3 or later
Author: Andrew McMillan andrew@mcmillan.net.nz
Located at XMLElement.php
Methods summary
public
# __construct( string $tagname, mixed $content = false, array $attributes = false, string $xmlns = null )

Constructor - nothing fancy as yet.

Constructor - nothing fancy as yet.

Parameters

$tagname
The tag name of the new element
$content
Either a string of content, or an array of sub-elements
$attributes
An array of attribute name/value pairs
$xmlns
An XML namespace specifier
public integer
# CountElements( )

Count the number of elements

Count the number of elements

Returns

integer
The number of elements
public
# SetAttribute( string $k, string $v )

Set an element attribute to a value

Set an element attribute to a value

Parameters

$k
attribute name
$v
attribute value
public
# SetContent( mixed $v )

Set the whole content to a value

Set the whole content to a value

Parameters

$v
element content, which may be text, or an array of sub-elements
public string
# GetTag( )

Accessor for the tag name

Accessor for the tag name

Returns

string
The tag name of the element
public string
# GetNSTag( )

Accessor for the full-namespaced tag name

Accessor for the full-namespaced tag name

Returns

string
The tag name of the element, prefixed by the namespace
public string
# GetAttribute( string $attr )

Accessor for a single attribute

Accessor for a single attribute

Parameters

$attr
The name of the attribute.

Returns

string
The value of that attribute of the element
public array
# GetAttributes( )

Accessor for the attributes

Accessor for the attributes

Returns

array
The attributes of this element
public array
# GetContent( )

Accessor for the content

Accessor for the content

Returns

array
The content of this element
public array
# GetElements( $tag = null, $recursive = false )

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 an array of elements matching the specified tag, or all elements if no tag is supplied. Unlike GetContent() this will always return an array.

Returns

array
The XMLElements within the tree which match this tag
public array
# GetPath( $path )

Return an array of elements matching the specified path

Return an array of elements matching the specified path

Returns

array
The XMLElements within the tree which match this tag
public
# AddSubTag( object & $v )

Add a sub-element

Add a sub-element

Parameters

$v
XMLElement to be appended to the array of sub-elements
public objectref &
# NewElement( string $tagname, mixed $content = false, array $attributes = false, $xmlns = null )

Add a new sub-element

Add a new sub-element

Parameters

$tagname
tag name of the new element
$content
a string of content, or an array of sub-elements
$attributes
array of attribute name/value pairs
$xmlns

Returns

objectref
A reference to the new XMLElement
public string
# RenderContent( $indent = 0, $nslist = null, $force_xmlns = false )

Render just the internal content

Render just the internal content

Returns

string
The content of this element, as a string without this element wrapping it.
public
# Render( integer $indent = 0, $xmldef = "", $nslist = null, $force_xmlns = false )

Render the document tree into (nicely formatted) XML

Render the document tree into (nicely formatted) XML

Parameters

$indent
indenting level for the pretty formatting of the element
$xmldef
$nslist
$force_xmlns
public
# __tostring( )
Properties summary
protected $tagname
#
protected $xmlns
#
protected $attributes
#
protected $content
#
protected $_parent
#
API documentation generated by ApiGen