function XMLTag::AddChild in Asset 6
Same name in this branch
- 6 asset_youtube/xmlparser.class.php \XMLTag::AddChild()
- 6 asset_youtube/inc/xmlparser.class.php \XMLTag::AddChild()
Same name and namespace in other branches
- 5 asset_youtube/xmlparser.class.php \XMLTag::AddChild()
Adds a direct child to this object
Parameters
string $name:
array $attrs:
int $parents:
File
- asset_youtube/
inc/ xmlparser.class.php, line 284
Class
- XMLTag
- XML Tag Object (php4)
Code
function AddChild($name, $attrs, $parents) {
//If there is no array already set for the tag name being added,
//create an empty array for it
if (!isset($this->{$name})) {
$this->{$name} = array();
}
//If the tag has the same name as a member in XMLTag, or somehow the
//array wasn't properly created, output a more informative error than
//PHP otherwise would.
if (!is_array($this->{$name})) {
trigger_error('You have used a reserved name as the name of an XML tag. Please consult the documentation (http://www.thousandmonkeys.net/xml_doc.php) and rename the tag named ' . $name . ' to something other than a reserved name.', E_USER_ERROR);
return;
}
//Create the child object itself
$child = new XMLTag($name, $attrs, $parents);
//Add the reference of it to the end of an array member named for the tag's name
$this->{$name}[] =& $child;
//Add the reference to the children array member
$this->tagChildren[] =& $child;
}