void DomDoc(
mixed
&$mxdData, [int
$intUse = XAO_DOC_NEW]
)
|
|
Constructor method
Create the objDoc instance property and associated ndRoot property based on the user-selected mode of document creation.
Parameters:
mixed |
&$mxdData: |
information required to create a DOM document |
int |
$intUse: |
constant specifying how the document is to be created |
API Tags:
void Arr2Atts(
node
&$ndEl, array
$arrAttribs
)
|
|
Turn an associative array into attributes
The hash keys are used for the attribute names and the values are used for the attribute values.
Parameters:
node |
&$ndEl: |
|
array |
$arrAttribs: |
|
API Tags:
void &arrNdXPath(
string
$strExpr
)
|
|
Return a list of nodes resulting from an XPath Query
This function runs the XPath query and returns an array of nodes matching the results. Unfortunately, xpath_eval() never divulges any error information. I assume that $objRes->nodeset holds a false value if the query errored.
Parameters:
string |
$strExpr: |
The XPath query |
API Tags:
void blnTestElementNode(
string
$ndEl
)
|
|
Test if the supplied node is on object of type "domelement"
This function is useful for testing variables that need to be accessed as domelement objects..
Parameters:
string |
$ndEl: |
The name to test. |
API Tags:
void blnTestXmlName(
string
$strName
)
|
|
Do a reliable test for a valid element name
This function tries to create an element using the supplied name. If it fails, then the name is assumed to be invalid.
Parameters:
string |
$strName: |
The name to test. |
API Tags:
void CommitToFile(
uri
$uriDestination
)
|
|
mass storage serialisation
This function will dump the ASCII version of this XML document [in it's current state] to a specified file.
Parameters:
uri |
$uriDestination: |
path to destination file |
API Tags:
void ConsumeDocData(
xml
$str
)
|
|
Import well-balenced XML data to append below $this->ndRoot
This function will consume the contents of an XML document.The content is then retained under $this->ndRoot
Parameters:
xml |
$str: |
Miscellaneous XML data |
API Tags:
node &ndAppendToNode(
node
&$ndStub, string
$strElName, [string
$strCont = ""]
)
|
|
quickly add a new element under an exising element node.
This function is basically a shortcut for the common task of adding a new element with some content under an existing node of the document.
Parameters:
node |
&$ndStub: |
a reference to the exisitng element node |
string |
$strElName: |
the name of the new element |
string |
$strCont: |
the content of the new element |
API Tags:
Return: | the newly added element node object |
Access: | public |
node &ndAppendToRoot(
string
$strElName, [string
$strCont = ""]
)
|
|
quickly add a new element under the root element.
This function is basically a shortcut for the common task of adding a new element with some content under the root element of the document.
Parameters:
string |
$strElName: |
the name of the new element |
string |
$strCont: |
the content of the new element |
API Tags:
Return: | the newly added element node object |
Access: | public |
void &ndConsumeDoc(
DomDoc
&$objDoc, [node
$ndStub = null]
)
|
|
Import a foreign PHP DOM XML document and append it below $this->ndRoot
This function will consume the contents of an entire DOM document and retain it below the root node of this DomDoc.
Parameters:
DomDoc |
&$objDoc: |
a reference to an exising PHP DOM XML document |
node |
$ndStub: |
an optional stub node to which the new data is grafted |
API Tags:
void ndConsumeFile(
uri
$uri, [mixed
$ndStub = null]
)
|
|
Import an XML document from a file and append it below $this->ndRoot
This function will consume the contents of an entire XML document from a file and retain it below the root node of this DomDoc.
Parameters:
uri |
$uri: |
the location of the XML file |
API Tags:
void ndConsumeFragData(
xml
$str, string
$strRoot, [mixed
$ndStub = null]
)
|
|
Import well-balenced XML data to append below $this->ndRoot
This function will consume the contents of some XML data after wrapping it in a root element whos name is specified in the second parameter. The content is then retained under $this->ndRoot
Parameters:
xml |
$str: |
Miscellaneous XML data |
string |
$strRoot: |
The name of the root element |
API Tags:
node &ndGetOneEl(
uri
$strName, [integer
$intIdx = 0]
)
|
|
fetch a single element node by name
A convenience function for fetching a node reference to an element by specifying only it's name.
Parameters:
uri |
$strName: |
name of the element whose node is to be returned |
integer |
$intIdx: |
index of which node to return (0 for first) |
API Tags:
node &ndImportChildFrag(
node
&$ndStub, node
&$ndNew
)
|
|
Import a fragment from a foreign PHP DOM XML document
This function will import a fragment from a foreign PHP DOM XML document below the node specified in the first parameter. This function is especially used by the other Consume methods in this class. At the moment it EXPLOITS the fact that node::replace_node() allows the use of foreign DOM XML objects - this is not in the spec. So this behaviour cannot be relied upon. It's worth noting that there is an xinclude() function which looks like it might be the way to go but documentation is vague http://www.xmlsoft.org/html/libxml-xinclude.html http://www.php.net/manual/en/function.domdocument-xinclude.php in any case, all maintenance for this functionality is centralised at this one point in the XAO api. If neccesary, it may eploy different techniques based on detecting which version of php/domxml is in use. Needless to say that this function is PIVOTAL to the XAO framework concept which uses aggregation to accumulate content through the CONSUME methods.
Parameters:
node |
&$ndStub: |
the node under which the fragment is to be grafted |
node |
&$ndNew: |
foreign node containing the fragment to be imported |
API Tags:
Return: | the newly added element node object |
Access: | public |
void ProcessCustomTags(
)
|
|
Process all nodes (domelements) due for processing.
When the user has finished nominating all the nodes for processing using either SetCustomTagName() or SetCustomTagQuery(), then this function can be called. It's a good idea to make sure this is only called as many times as it needs to be (once).
API Tags:
void SetCustomTagName(
string
$elName, string
$fncName
)
|
|
Have all elements of a specified name processed by a call-back function.
This functionality is dubious when using namespaces. The experimental nature of PHP's DOMXML extension makes it impossible to guarentee safe usage.
Parameters:
string |
$elName: |
name of element to be globally matched |
string |
$fncName: |
name of user-defined callback function |
API Tags:
void SetCustomTagQuery(
string
$strQuery, string
$fncName
)
|
|
Use an XPath to nominate nodes for processing by a call-back function.
This functionality is dubious when using namespaces. The experimental nature of PHP's DOMXML extension makes it impossible to guarentee safe usage.
Parameters:
string |
$strQuery: |
XPath query |
string |
$fncName: |
name of user-defined callback function |
API Tags:
void Throw(
string
$strErrMsg, [array
$arrAttribs = null]
)
|
|
Base error logger
All DomDoc based objects should use this method to raise errors. The method will not stop execution. It will create elements on the DomDoc tree containing all the error data available. It is up to the stylsheet to extract and render error information through an appropriate template. Users should note the ability to define a custom call-back function which may be created as a method in the child object. To do this, populate $this->strErrCallbackFunc with the name of your custom error method. To find out more about how the exception elements are populated, check out the documentation in the Exceptions class.
Parameters:
string |
$strErrMsg: |
Main error message for display |
array |
$arrAttribs: |
A hash of attributes/values to include in error element |
API Tags:
Redefinition of:
- XaoRoot::Throw()
- Generic/default error handler.
Redefined in descendants as:
-
AppDoc::Throw()
: Wrapper for parent::throw() function adding ability to abort script
Serialise and return the entire document object as stand-alone XML.
This is used when the entire XML document is required in ASCII format.
API Tags:
Return: | document |
Access: | public |
Serialise and return the entire document as an XML fragment.
This is used when an ASCII version of the XML document is required _without_ any XML declaration or processing instructions. Everything below and including the root element is serialised.
API Tags:
Return: | fragment |
Access: | public |