php5 dom,DOMDocument->createElementNS() - PHP 5 中文文档

(no version information, might be only in CVS)

DOMDocument->createElementNS()–

Create new element node with an associated namespace

说明

class DOMDocument

{

DOMElement createElementNS

( string namespaceURI, string qualifiedName [, string value] )

}

This function creates a new element node with an associated namespace.

本节点不会出现在文档中,除非是用例如

DOMNode->appendChild()

函数来插入的。

参数

namespaceURI

The URI of the namespace.

qualifiedName

The qualified name of the element, as prefix:tagname

.

value

The value of the element. By default, an empty element will be created.

You can also set the value later with DOMElement->nodeValue

.

返回值

The new DOMElement

or FALSE

if an error occured.

异常

DOM_INVALID_CHARACTER_ERR

Raised if qualifiedName

contains an invalid character.

DOM_NAMESPACE_ERR

Raised if qualifiedName

is a maformed qualified

name.

例子 1. Creating a new element and inserting it as root

<?php $dom = new DOMDocument('1.0', 'iso-8859-1');$element = $dom->createElementNS('http://www.example.com/XFoo', 'xfoo:test', 'This is the root element!');// We insert the new element as root (child of the document)$dom->appendChild($element);echo $dom->saveXML();?>

上例将输出:

This is the root element!

参见

DOMNode->appendChild()

DOMDocument->createAttribute()

DOMDocument->createAttributeNS()

DOMDocument->createCDATASection()

DOMDocument->createComment()

DOMDocument->createDocumentFragment()

DOMDocument->createElement()

DOMDocument->createEntityReference()

DOMDocument->createProcessingInstruction()

DOMDocument->createTextNode()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值