XML Class
Name: XML
Description:
- * XML class provides a tree-like structure to read/write/modify XML
Package: org.active-link.xml
Author: Zurab Davitiani
Version: 0.4.0
Extends: Tree
Requires: Tag, Tree, XMLBranch, XMLLeaf
See: Tree
All Methods
XML
addXMLAsBranch
addXMLBranch
addXMLLeaf
getBranches
getLeafs
getTagAttribute
getTagContent
getTagName
getXMLContent
getXMLString
hasBranch
hasLeaf
parseFromString
parseNodesFromTag
removeAllBranches
removeAllLeafs
removeBranches
setBranchTag
setTag
setTagAttribute
setTagContent
XML
( optional string argument )
Description:
- * If argument is an XML String it parses the string into XML object
- * If argument is a tag path, creates appropriate branches and tags
- * If argument is a simple string then sets that as a root tag name
Returns: none
Arguments:
addXMLAsBranch
( object xml, optional mixed id )
Description:
- * Adds another XML tree as a branch to the current XML object
Returns: true if successful, false otherwise
Arguments:
- object xml
- optional mixed id
addXMLBranch
( object xmlBranch, optional mixed id )
Description:
- * Adds XML Branch to the current XML object
Returns: true if successful, false otherwise
Arguments:
- object xmlBranch
- optional mixed id
addXMLLeaf
( object xmlLeaf, optional mixed id )
Description:
- * Adds XML Leaf to the current XML object
Returns: true if successful, false otherwise
Arguments:
- object xmlLeaf
- optional mixed id
getBranches
( optional string tagPath, optional string tagName, optional string attrName, optional string attrValue )
Description:
- * Retrieves an array of references to XMLBranches within the specified path, tag name, attribute name, and attribute value
Returns: array of references to XMLBranch objects that meet specified criteria, or false if none found
Arguments:
- optional string tagPath
- optional string tagName
- optional string attrName
- optional string attrValue
getLeafs
( optional string tagPath )
Description:
- * Retrieves an array of references to XMLLeaf(s) within the specified path
Returns: array of references to XMLLeaf objects in specified tag path, false if none found
Arguments:
getTagAttribute
( string attributeName, optional string tagPath )
Description:
- * Returns attribute value of the specified tag and tagpath
Returns: attribute of the specified tag if successful, false otherwise
Arguments:
- string attributeName
- optional string tagPath
getTagContent
( optional string tagPath )
Description:
- * Returns contents of the specified tag path
Returns: content of the tag from the specified path if successful, false otherwise
Arguments:
getTagName
( )
Description:
- * Retrieves the tag name of the current object
Returns: tag name
getXMLContent
( )
Description:
- * Gets contents from the current object
Returns: contents of the current XML tag
getXMLString
( optional mixed indent )
Description:
- * Gets the whole XML string of the current object
Returns: complete XML string of current object
Arguments:
hasBranch
( )
Description:
- * Find out whether the current object has any branches
Returns: true if branches exist, false otherwise
hasLeaf
( )
Description:
- * Find out whether the current object has any leaf(s)
Returns: true if leaf(s) exist, false otherwise
parseFromString
( string parseString )
Description:
- * Parse entire XML string into the current object; also called from constructor
Returns: none
Arguments:
parseNodesFromTag
( )
Description:
- * Parses the current tag content into Branches and Leaf(s); called from parseFromString
Returns: none
removeAllBranches
( )
Description:
- * Removes all Branches from current object
removeAllLeafs
( )
Description:
- * Removes all Leaf(s) from current object
removeBranches
( optional string tagPath, optional string tagName, optional string attrName, optional string attrValue )
Description:
- * Removes Branches with the specified criteria
Returns: number of branches deleted
Arguments:
- optional string tagPath
- optional string tagName
- optional string attrName
- optional string attrValue
setBranchTag
( mixed branchId, object tag )
Description:
- * Sets tag object of a branch specified by branch ID for the current object; see getBranches and setTag
Returns: true on success, false otherwise
Arguments:
- mixed branchId
- object tag
setTag
( object tag )
Description:
- * Sets tag object of the current object
Returns: true if successful, false otherwise
Arguments:
setTagAttribute
( string attributeName, optional string attributeValue, optional string tagPath )
Description:
- * Sets an attribute name and value on an existing tag found via tagpath string
Returns: true if successful, false otherwise
Arguments:
- string attributeName
- optional string attributeValue
- optional string tagPath
setTagContent
( mixed content, optional string tagPath )
Description:
- * Sets content of the specified tag
Returns: true if successful, false otherwise
Arguments:
- mixed content
- optional string tagPath