|
@@ 364-373 (lines=10) @@
|
| 361 |
|
* The $newnode, properly attached to DOMDocument. If you passed $newnode as a DOMElement |
| 362 |
|
* then you should replace your DOMElement with the returned one. |
| 363 |
|
*/ |
| 364 |
|
public function append($newnode, $context = NULL) { |
| 365 |
|
$this->createContext($newnode, 'xml'); |
| 366 |
|
$this->createContext($context, 'xpath'); |
| 367 |
|
|
| 368 |
|
if (!$context || !$newnode) { |
| 369 |
|
return FALSE; |
| 370 |
|
} |
| 371 |
|
|
| 372 |
|
return $context->appendChild($newnode); |
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
/** |
| 376 |
|
* Append a child to the context node, make it the first child |
|
@@ 389-398 (lines=10) @@
|
| 386 |
|
* The $newnode, properly attached to DOMDocument. If you passed $newnode as a DOMElement |
| 387 |
|
* then you should replace your DOMElement with the returned one. |
| 388 |
|
*/ |
| 389 |
|
public function prepend($newnode, $context = NULL) { |
| 390 |
|
$this->createContext($newnode, 'xml'); |
| 391 |
|
$this->createContext($context, 'xpath'); |
| 392 |
|
|
| 393 |
|
if (!$context || !$newnode) { |
| 394 |
|
return FALSE; |
| 395 |
|
} |
| 396 |
|
|
| 397 |
|
return $context->insertBefore($newnode, $context->firstChild); |
| 398 |
|
} |
| 399 |
|
|
| 400 |
|
/** |
| 401 |
|
* Prepend a sibling to the context node, put it just before the context node |
|
@@ 414-423 (lines=10) @@
|
| 411 |
|
* The $newnode, properly attached to DOMDocument. If you passed $newnode as a DOMElement |
| 412 |
|
* then you should replace your DOMElement with the returned one. |
| 413 |
|
*/ |
| 414 |
|
public function prependSibling($newnode, $context = NULL) { |
| 415 |
|
$this->createContext($newnode, 'xml'); |
| 416 |
|
$this->createContext($context, 'xpath'); |
| 417 |
|
|
| 418 |
|
if (!$context || !$newnode) { |
| 419 |
|
return FALSE; |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
return $context->parentNode->insertBefore($newnode, $context); |
| 423 |
|
} |
| 424 |
|
|
| 425 |
|
/** |
| 426 |
|
* Append a sibling to the context node, put it just after the context node |