Dealing with XML errors
SimpleXMLElement::addAttribute
SimpleXML
PHP Manual
The SimpleXMLElement class
简介
Represents an element in an XML document.
类摘要
SimpleXMLElement
implements
Traversable
{
/* 方法 */
public
__construct
(
string
$data
[,
int
$options
= 0
[,
bool
$data_is_url
= false
[,
string
$ns
= ""
[,
bool
$is_prefix
= false
]]]] )
public
void
addAttribute
(
string
$name
,
string
$value
[,
string
$namespace
] )
public
SimpleXMLElement
addChild
(
string
$name
[,
string
$value
[,
string
$namespace
]] )
public
mixed
asXML
([
string
$filename
] )
public
SimpleXMLElement
attributes
([
string
$ns
=
NULL
[,
bool
$is_prefix
= false
]] )
public
SimpleXMLElement
children
([
string
$ns
[,
bool
$is_prefix
= false
]] )
public
int
count
(
void
)
public
array
getDocNamespaces
([
bool
$recursive
= false
] )
public
string
getName
(
void
)
public
array
getNamespaces
([
bool
$recursive
= false
] )
public
bool
registerXPathNamespace
(
string
$prefix
,
string
$ns
)
public
array
xpath
(
string
$path
)
}
Table of Contents
SimpleXMLElement::addAttribute
— Adds an attribute to the SimpleXML element
SimpleXMLElement::addChild
— Adds a child element to the XML node
SimpleXMLElement::asXML
— Return a well-formed XML string based on SimpleXML element
SimpleXMLElement::attributes
— Identifies an element's attributes
SimpleXMLElement::children
— Finds children of given node
SimpleXMLElement::__construct
— Creates a new SimpleXMLElement object
SimpleXMLElement::count
— Counts the children of an element
SimpleXMLElement::getDocNamespaces
— Returns namespaces declared in document
SimpleXMLElement::getName
— Gets the name of the XML element
SimpleXMLElement::getNamespaces
— Returns namespaces used in document
SimpleXMLElement::registerXPathNamespace
— Creates a prefix/ns context for the next XPath query
SimpleXMLElement::saveXML
— 别名 SimpleXMLElement::asXML
SimpleXMLElement::xpath
— Runs XPath query on XML data
Dealing with XML errors
SimpleXMLElement::addAttribute
SimpleXML
PHP Manual