1. DOM function
a. DOMDocument->load()
Function: Load xml file
Usage: DOMDocument->load( string filename )
Parameters: filename, xml file;
Return: TRUE if successful, FALSE if failed.
b. DOMDocument->loadXML()
Function: Load xml code
Usage: DOMDocument->loadXML( string source )
Parameters: source xml code;
Return: TRUE if successful, FALSE if failed.
c. DOMDocument->getElementsByTagName_r()
Function: Search
by tag nameUsage: DOMDocument->getElementsByTagName_r(string name)
Parameters: name, label name;
Return: new DOMNodeList object.
d. DOMDocument->getElementById()
Function: Search
by tag nameUsage: DOMDocument->getElementById(string elementId)
Parameters: elementId, tag id;
Return: new DOMNodeList object.
e.DOMDocument->createElement_x_x()
Function: Create tags
Usage: DOMDocument->createElement_x_x(string name [, string value] )
Parameters: name, tag name, value, only;
Return: new DOMElement object, false on failure.
f. DOMDocument->createTextNode()
Function: Create text node
Usage: DOMDocument->createTextNode(string content)
Parameters: content, content;
Return: new DOMText object, false on failure.
h. DOMDocument->createCDATASection()
Function: Create cdata node
Usage: DOMDocument->createCDATASection( string data)
Parameters: data, content;
Return: new DOMCDATASection object, false on failure.
i. DOMDocument->createAttribute()
Function: Create label attributes
Usage: DOMDocument->createAttribute(string name)
Parameters: name, attribute name;
Return: new DOMAttr object, false on failure.
j.DOMDocument->validate()
Function: Check xml code
Usage: DOMDocument->validate()
Parameters: None
Return: TRUE if successful, FALSE if failed.
k、DOMDocument->save()
Function: Save xml code to xml file
Usage: DOMDocument->save(string filename)
Parameters: filename, xml file;
Return: Returns the xml character length if successful, false if failed.
l. DOMDocument->saveXML()
Function: Save xml code
Usage: DOMDocument->saveXML([DOMNode node [, int options]])
Parameters: node, DOMNode;
Return: Return xml if successful, false if failed.
m、DOMElement->hasAttribute()
Function: Detect whether the attribute exists
Usage: DOMElement->hasAttribute(string name)
Parameters: name, attribute name;
Return: TRUE if successful, FALSE if failed.
n. DOMElement->getAttribute()
Function: Get attribute value
Usage: DOMElement->getAttribute(string name)
Parameters: name, attribute name;
Return: The attribute value is returned on success, and empty on failure.
o.DOMElement->getAttribute()
Function: Get attribute value
Usage: DOMElement->getAttribute(string name)
Parameters: name, attribute name;
Return: The attribute value is returned on success, and empty on failure.
p、DOMElement->setAttribute()
Function: Set attribute value
Usage: DOMElement->setAttribute(string name, string value)
Parameters: name, attribute name; value, attribute value
Return: TRUE if successful, FALSE if failed.
q、DOMNode->appendChild()
Function: Link child nodes to parent nodes
Usage: DOMNode->appendChild(DOMNode newnode)
Parameters: newnode, new node;
Return: Return a new node if successful, return empty if failed.
r、DOMNode->hasAttributes()
Function: Check whether there are attributes
Usage: DOMNode->hasAttributes( )
Parameters: None
Return: TRUE if successful, FALSE if failed.
s, DOMNode->hasChildNodes()
Function: Check whether there are child nodes
Usage: DOMNode->hasChildNodes()
Parameters: None
Return: TRUE if successful, FALSE if failed.
t、DOMNode->insertBefore()
Function: Insert the child node into the DOM tree in front of a certain node
Usage: DOMNode->insertBefore(DOMNode newnode [, DOMNode refnode] )
Parameters: newnode, new node; refnode, reference node
Return: Returns a new node if successful, returns empty if failed.
u. DOMNode->removeChild()
Function: Delete child nodes
Usage: DOMNode->removeChild(DOMNode oldnode)
Parameters: oldnode, child node;
Return: Returns child nodes on success, returns empty on failure.
v. DOMNode->replaceChild()
Function: Update child nodes
Usage: DOMNode->replaceChild(DOMNode newnode, DOMNode oldnode)
Parameters: newnode, new node; oldnode, old node
Return: Return oldnode on success, empty on failure.
————————-DOMNode attribute————————————–
a. DOMNode->nodeType
Function: Get node type
b. DOMNode->nodeName
Function: Get node name
c. DOMNode->nodeValue
Function: Get node content
d. DOMNode->textContent
Function: Get node content
e. DOMNode->parentNode
Function: Get the parent node of the node
f. DOMNode->childNodes
Function: Get node child nodes
g、DOMNode->firstChild
Function: Get the first child node of the node
h、DOMNode->lastChild
Function: Get the last child node of the node
2. XMLReader
a. XMLReader::XML
Function: Load xml string
Usage: XMLReader::xml(string source [, string encoding [, int options]] )
Parameters: source, xml string; encoding, document encoding or NULL
Return: TRUE if successful, FALSE if failed.
b. XMLReader::open
Function: Load xml file
Usage: XMLReader::open(string url [, string encoding [, int options]] )
Parameters: url, link to xml; encoding, document encoding or NULL
Return: TRUE if successful, FALSE if failed.
c. XMLReader::read
Function: Read xml and make the parser advance to the next tag
Usage: XMLReader::read(), traverse the entire document in a while loop
Parameter: NULL
Return: TRUE if successful, FALSE if failed.
d. XMLReader::getAttribute
Function: Get attributes
Usage: XMLReader::getAttribute(string name)
Parameters: name, attribute name
Return: Returns the attribute value if successful, returns FALSE if failed.
e. XMLReader::isValid
Function: Check whether the xml is legal
Usage: XMLReader::isValid()
Parameters: None
Return: true if successful, FALSE if failed.
f. XMLReader::moveToAttribute
Function: Move focus to the pointed attribute
Usage: XMLReader::moveToAttribute(string name)
Parameters: name, attribute name
Return: true if successful, FALSE if failed.
g、XMLReader::moveToFirstAttribute
Function: Move focus to the first attribute
Usage: XMLReader::moveToFirstAttribute()
Parameters: None
Return: true if successful, FALSE if failed.
h、XMLReader::moveToNextAttribute
Function: Move focus to the next attribute
Usage: XMLReader::moveToNextAttribute()
Parameters: None
Return: true if successful, FALSE if failed.
i. XMLReader::moveToElement
Function: Move focus to the current attribute of the parent node
Usage: XMLReader::moveToElement()
Parameters: None
Return: true if successful, FALSE if failed.
j、XMLReader::close
Function: Close xml input
Usage: XMLReader::close()
Parameters: None
Return: true if successful, FALSE if failed.
——————-Constant————————–
XMLReader::NONE = 0 ;
XMLReader::ELEMENT = 1 ;
XMLReader::ATTRIBUTE = 2 ;
XMLReader::TEXT = 3;
XMLReader::CDATA = 4 ;
XMLReader::ENTITY_REF = 5 ;
XMLReader::ENTITY = 6 ;
XMLReader::PI = 7 ;
XMLReader::COMMENT = 8 ;
XMLReader::DOC = 9 ;
XMLReader::DOC_TYPE = 10;
XMLReader::DOC_FRAGMENT = 11;
XMLReader::NOTATION = 12;
XMLReader::WHITESPACE = 13;
XMLReader::SIGNIFICANT_WHITESPACE = 14;
XMLReader::END_ELEMENT = 15;
XMLReader::END_ENTITY = 16;
XMLReader::XML_DECLARATION = 17;
XMLReader::LOADDTD = 1 ;
XMLReader::DEFAULTATTRS = 2;
XMLReader::VALIDATE = 3 ;
XMLReader::SUBST_ENTITIES = 4;
————————Properties——————————–
a. XMLReader->attributeCount ;
Function: Number of attributes
b. XMLReader->baseURI;
Function: node url
c. XMLReader->depth ;
Function: The number of layers of the node tree
d. XMLReader->hasAttributes;
Function: Check whether there are attributes
e. XMLReader->hasValue;
Function: Whether it has value
f. XMLReader->isEmptyElement;
Function: Whether it is an empty tag
g、XMLReader->localName;
Function: Label inside the label
h、XMLReader->name ;
Function: Tag name
i. XMLReader->nodeType;
Function: Node type
j、XMLReader->value ;
Function: Node text content
3. XMLWriter
a. XMLWriter::openURI
Function: Create a new XMLWriter from the url output code
Usage: XMLWriter::openURI(string uri)
Parameters: url xml address
Return: true if successful, FALSE if failed.
b. XMLWriter::setIndentString
Function: Set the indent character
Usage: XMLWriter::setIndentString(string indentString)
Parameter: indentString indent character
Return: true if successful, FALSE if failed.
c. XMLWriter::setIndent
Function: Set the indent switch
Usage: XMLWriter::setIndent(bool indent)
Parameter: indent whether to indent or not
Return: true if successful, FALSE if failed.
d. XMLWriter::startDocument
Function: Set the document start tag
Usage: XMLWriter::startDocument( [string version [, string encoding [, string standalone]]] )
Parameters: version, version; encoding, encoding; standalone, independent
Return: true if successful, FALSE if failed.
e. XMLWriter::endDocument
Function: Set the document end tag
Usage: XMLWriter::endDocument( )
Parameters: None
Return: true if successful, FALSE if failed.
f. XMLWriter::startDTD
Function: Set the dtd start tag
Usage: XMLWriter::startDTD( string qualifiedName [, string publicId [, string systemId]] )
Parameters: qualifiedName, name; publicId, piublic; systemId, system
Return: true if successful, FALSE if failed.
g、XMLWriter::endDTD
Function: Set the dtd end tag
Usage: XMLWriter::endDTD()
Parameters: None
Return: true if successful, FALSE if failed.
h、XMLWriter::startElement
Function: Set the start tag
Usage: XMLWriter::startElement(string name)
Parameters: name, label name
Return: true if successful, FALSE if failed.
i. XMLWriter::endElement
Function: Set the closing tag
Usage: XMLWriter::endElement()
Parameters: None
Return: true if successful, FALSE if failed.
j、XMLWriter::startCData
Function: Set the start tag
Usage: XMLWriter::startCData()
Parameters: None
Return: true if successful, FALSE if failed.
k、XMLWriter::endCData
Function: Set the closing tag
Usage: XMLWriter::endCData ()
Parameters: None
Return: true if successful, FALSE if failed.
l. XMLWriter::writeAttribute
Function: Write tag attributes
Usage: XMLWriter::writeAttribute (string name, string value)
Parameters: name, attribute name; value, attribute value
Return: true if successful, FALSE if failed.
m、XMLWriter::writeElement
Function: Write tag attributes
Usage: XMLWriter::writeElement (resource xmlwriter, string name, string content)
Parameters: xmlwriter, xml resource; name, tag name; value, text value
Return: true if successful, FALSE if failed.
n. XMLWriter::writeCData
Function: Write tag attributes
Usage: XMLWriter::writeCData (resource xmlwriter, string content)
Parameters: xmlwriter, xml resource; value, text value
Return: true if successful, FALSE if failed.
o、XMLWriter::text
Function: Write text
Usage: XMLWriter::text (string content)
Parameters: content, text value
Return: true if successful, FALSE if failed.
p、XMLWriter::flush
Function: Clear cache
Usage: XMLWriter::flush ( )
Parameters: None
Return: true if successful, FALSE if failed.