summaryrefslogtreecommitdiff
path: root/ext/dom/tests/DOM4_DOMNode_before_ns.phpt
blob: 6ff2ca7729a350290861a613c4aced799d884419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
DOMNode::before() with namespace
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
require_once("dom_test.inc");

$doc  = new DOMDocument('1.0', 'utf-8');
$doc->formatOutput = true;

$root = $doc->createElementNS('http://www.w3.org/2005/Atom', 'element');
$doc->appendChild($root);
$root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:g', 'http://base.google.com/ns/1.0');

$item = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'house');
$root->append($item);

$item2 = $doc->createElementNS('http://base.google.com/ns/1.0', 'g:item_type', 'street');
$item->before($item2);

echo $doc->saveXML(), "\n";
?>
--EXPECT--
<?xml version="1.0" encoding="utf-8"?>
<element xmlns="http://www.w3.org/2005/Atom" xmlns:g="http://base.google.com/ns/1.0">
  <g:item_type>street</g:item_type>
  <g:item_type>house</g:item_type>
</element>