PHP 5 SimpleXML Functions

PHP SimpleXML Introduction

SimpleXML is an expansion that enables us to effectively control and get XML information. 

SimpleXML gives a simple approach to getting a component's name, traits and printed substance in the event that you realize the XML report's structure or designs. 

SimpleXML transforms into XML archives into an information structure you can emphasize through like an accumulation of exhibits and items.

Installation

As of PHP 5, the SimpleXML capacities is a piece of the PHP centers.  No installation is required to use these function.


PHP 5 SimpleXML Functions

FunctionDescription
__construct()Creates a new SimpleXMLElement object
addAttribute()Adds an attribute to the SimpleXML element
addChild()Adds a child element the SimpleXML element
asXML()Returns a well-formed XML string (XML versions 1.0) from a SimpleXML objects.
attributes()Returns the attributes/values of an element
children()Returns the children of a specified node
count()Counts the children of a specified node
getDocNamespaces()Returns the namespaces DECLARED in document
getName()Returns the name of the XML tag reference by the SimpleXML element
getNamespaces()Returns the namespaces USED in document
registerXPathNamespace()Create a namespaces context for the next XPath querys
saveXML()Alias of asXML() function
simplexml_import_dom()Return a SimpleXMLElement object from a DOM node
simplexml_load_file()Converts an XML file into a SimpleXMLElement object
simplexml_load_string()Convert an XML string into a SimpleXMLElement object
xpath()Runs an XPath query on XML data

PHP 5 SimpleXML Iteration Functions

FunctionDescription
current()Returns the current element
getChildren()Returns the child element of the current element
hasChildren()Checks whether the current element has children
key()Return the current key
next()Moves to the next element
rewind()Rewind to the first element
valid()Check whether the current element is valid

No comments:

Post a Comment