ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDOM2Util Class Reference

DOM 2 util. More...

+ Collaboration diagram for ilDOM2Util:

Static Public Member Functions

static changeName ($node, $name, $keep_attributes=true)
 Change name of a node.
static addParent ($node, $name)
 Add parent.
static replaceByChilds ($node)
 Replace a node by its child.

Detailed Description

DOM 2 util.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$ /

Definition at line 11 of file class.ilDOM2Util.php.

Member Function Documentation

static ilDOM2Util::addParent (   $node,
  $name 
)
static

Add parent.

Parameters
object$node
Returns

Definition at line 47 of file class.ilDOM2Util.php.

Referenced by ilPCParagraph\handleAjaxContent().

{
$newnode = $node->ownerDocument->createElement($name);
//echo htmlentities($node->ownerDocument->saveXML($node->ownerDocument->documentElement));
//echo "<br>".htmlentities($node->ownerDocument->saveXML($node)); exit;
$par = $node->parentNode;
//var_dump($node);
//var_dump($par);
if ($next_sib = $node->nextSibling)
{
$newnode = $par->insertBefore($newnode, $next_sib);
}
else
{
$newnode = $par->appendChild($newnode);
}
$node = $par->removeChild($node);
$newnode->appendChild($node);
// foreach ($node->childNodes as $child)
// {
// $child2 = $child->cloneNode(true);
// $newnode->appendChild($child2);
// }
return $newnode;
}

+ Here is the caller graph for this function:

static ilDOM2Util::changeName (   $node,
  $name,
  $keep_attributes = true 
)
static

Change name of a node.

Parameters
object$node
stringnew name
Returns

Definition at line 20 of file class.ilDOM2Util.php.

Referenced by ilPCParagraph\handleAjaxContent().

{
$newnode = $node->ownerDocument->createElement($name);
foreach ($node->childNodes as $child)
{
$child2 = $child->cloneNode(true);
$newnode->appendChild($child2);
}
if ($keep_attributes)
{
foreach ($node->attributes as $attrName => $attrNode)
{
$newnode->setAttribute($attrName, $attrNode);
}
}
$node->parentNode->replaceChild($newnode, $node);
return $newnode;
}

+ Here is the caller graph for this function:

static ilDOM2Util::replaceByChilds (   $node)
static

Replace a node by its child.

Parameters
object$node
Returns

Definition at line 82 of file class.ilDOM2Util.php.

Referenced by ilPCParagraph\handleAjaxContent().

{
foreach ($node->childNodes as $child)
{
$child2 = $child->cloneNode(true);
$node->parentNode->insertBefore($child2, $node);
}
$node->parentNode->removeChild($node);
}

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: