Documentation automatically generated from the source-code using phpDocumentor.
Official Homepage: xao-php.sourceforge.net
XAO
Official homepage | API home | class tree: XAO | index: XAO | all elements

Class: AppDoc

Source Location: Program_Root/XAO_AppDoc.php

Class AppDoc

Class Overview

XML Application Object

AppDoc is the "Application Object" part of the XAO acronym. It represents the "Application Document" in the context of XML being a document. So the contents delivered to the user by the "Application" is contentained in the "Document" held as a DOM XML document by AppDoc::objDoc. the objDoc property is inherited from the DomDoc class. The AppDoc class provides extra functionality on DomDoc that is specifically needed for typical "framework mode" usage of XAO. Usage of this class assumes that the user will be employing XAO in framework mode. In short, this is the framework class for XAO. It is advisable to consult the tutorials shipped with XAO to obtain an understanding of how this class is intended to be used.

Located in Program_Root/XAO_AppDoc.php [line 58]

XaoRoot
   |
   --DomDoc
      |
      --AppDoc

Properties

Methods

[ Top ]
Inherited Properties and Methods
Inherited Properties Inherited Methods

Inherited From DomDoc

DomDoc::$ndErr
DomDoc::$ndRoot
DomDoc::$objDoc
DomDoc::$objErr

Inherited From XaoRoot

XaoRoot::$arrCacheParams
XaoRoot::$fncErrCallbackFunc
XaoRoot::$idXaoNamespace
XaoRoot::$strDebugData
XaoRoot::$strError
XaoRoot::$strXaoNamespacePrefix

Inherited From DomDoc

DomDoc::DomDoc()
Constructor method
DomDoc::Arr2Atts()
Turn an associative array into attributes
DomDoc::arrNdXPath()
Return a list of nodes resulting from an XPath Query
DomDoc::blnTestElementNode()
Test if the supplied node is on object of type "domelement"
DomDoc::blnTestXmlName()
Do a reliable test for a valid element name
DomDoc::CommitToFile()
mass storage serialisation
DomDoc::ConsumeDocData()
Import well-balenced XML data to append below $this->ndRoot
DomDoc::ndAppendToNode()
quickly add a new element under an exising element node.
DomDoc::ndAppendToRoot()
quickly add a new element under the root element.
DomDoc::ndConsumeDoc()
Import a foreign PHP DOM XML document and append it below $this->ndRoot
DomDoc::ndConsumeFile()
Import an XML document from a file and append it below $this->ndRoot
DomDoc::ndConsumeFragData()
Import well-balenced XML data to append below $this->ndRoot
DomDoc::ndGetOneEl()
fetch a single element node by name
DomDoc::ndImportChildFrag()
Import a fragment from a foreign PHP DOM XML document
DomDoc::ProcessCustomTags()
Process all nodes (domelements) due for processing.
DomDoc::SetCustomTagName()
Have all elements of a specified name processed by a call-back function.
DomDoc::SetCustomTagQuery()
Use an XPath to nominate nodes for processing by a call-back function.
DomDoc::Throw()
Base error logger
DomDoc::xmlGetDoc()
Serialise and return the entire document object as stand-alone XML.
DomDoc::xmlGetFrag()
Serialise and return the entire document as an XML fragment.

Inherited From XaoRoot

XaoRoot::arrSetErrFnc()
XaoRoot::blnTestSafeName()
XaoRoot::Throw()
Generic/default error handler.

[ Top ]
Property Summary
array   $arrXslParams   Stylesheet parameters
array   $arrXsltCacheParams   Cache parameters for the XSLT tranformation result
boolean   $blnClientSideTransform   Force client-side XSL Transformation attempt.
boolean   $blnDebug   Debug option
node   $ndStylePi   Stylesheet processing instruction node
object   $objXsl   Stylesheet native PHP DOM XML object
string   $strAltPayload   Storage slot for alternative payload
boolean   $strForceContentType   Debug option
string   $strXsltProcessor   Which XSLT processor to use
uri   $uriErrorStyle   Dedicated Error output display template

[ Top ]
Method Summary
void   AppDoc()   AppDoc constructor
bool   &ndSetStylePI()   Insert stylesheet processing instruction
void   Send()   Send the serialised XML content of this object to the client
void   SetInternalErrorStyle()   Set the name of the internal error stylsheet using in debug mode
string   strGetPayload()   Return data that would be destined for the client (in current state)
void   Throw()   Wrapper for parent::throw() function adding ability to abort script
void   Transform()   Prepares $this->strAltPayload with XSLT transformation result data
uri   uriGetInternalErrorStyle()   Get the absolute system location of the internal error stylsheet.

[ Top ]
Properties
array   $arrXslParams = array() [line 85]

Stylesheet parameters

See documentation in the Transformer class on the variable with the same name.

API Tags:
Access:  public


[ Top ]
array   $arrXsltCacheParams = array() [line 74]

Cache parameters for the XSLT tranformation result

In the standard XAO framework, caching can be done at two stages. The first is at the content generation stage which uses $arrDocCacheParams, the second is at the transformation results stage which uses this array. The array has the same requirements and is used in exactly the same way as the $arrDocCacheParams array. It is passed to the Transformer class (by $this->Transform method) which then uses CacheMan to implement it. Also see doc comments at XaoRoot::arrCacheParams for more info.

API Tags:
Access:  public


[ Top ]
boolean   $blnClientSideTransform = false [line 131]

Force client-side XSL Transformation attempt.

This causes the TransformSend() method to bypass server-side transformation and send the source document directly to the client. If the stylsheet PI is set, then the client should find it and perform it's own transformation.

API Tags:
Access:  public


[ Top ]
boolean   $blnDebug = false [line 171]

Debug option

Designed to be used during development, this object will cause error output to be more verbose unser certain conditions. It may also be used by the developer to output diagnostic information at run-time. It is kept off by default in case it proposes any security issues.

API Tags:
Access:  public


[ Top ]
node   $ndStylePi [line 210]

Stylesheet processing instruction node

This is the node object representing the stylesheet PI. It is set using the ndSetStylePI() method which only matains one PI node for the stylesheet. If a user overrides the $_uriStyleSheet member variable with a populated version, this ndSetStylePI() is called with it in the contructor.

API Tags:
Access:  public


[ Top ]
object   $objXsl [line 237]

Stylesheet native PHP DOM XML object

This variable is populated if the specified stylsheet is successfully opened as an XML document.

API Tags:
Access:  public


[ Top ]
string   $strAltPayload = false [line 106]

Storage slot for alternative payload

If this variable is populated, then this is all that is sent to the UA via the AppDoc::Send method. If it is left empty, then the AppDoc::Send method will send the serialised content of DomDoc::objDoc This method is provided as a method of short-circuiting the default behavior of AppDocc::Send - thereby allowing AppDoc::Send to be the single/only way for which the payload is transmitted. This is very important because it allows XAO framework to sentralise control script completion and payload transmission. An example of where an alternate payload is needed is an XSLT transformation result. Other instances, where the well-formedness of a payload cannot be garenteed, will also require the use of this string variable.

API Tags:
Access:  public


[ Top ]
boolean   $strForceContentType [line 184]

Debug option

Designed to be used during development, this object will cause error output to be more verbose unser certain conditions. It may also be used by the developer to output diagnostic information at run-time. It is kept off by default in case it proposes any security issues.

API Tags:
Access:  public


[ Top ]
string   $strXsltProcessor = "DOMXML" [line 226]

Which XSLT processor to use

This option allows the user to choose which implemented XSLT processor to employ. At this stage, possible choices are:

  • SABLOTRON which uses the xslt_ functions built into PHP.
  • DOMXML which uses the experimental transformation capabilities of the native PHP domxml extension itself.
Future implementations could use external procesors which may be Java, Com, or command-line executables.

API Tags:
Access:  public


[ Top ]
uri   $uriErrorStyle [line 146]

Dedicated Error output display template

Under certain conditions, the availability of a dedicated error template will cause an exceptional condition to output the error DOM object (with all it's errors so far) using the same rules as $this->Send(). An example is the Transform object which uses it when $this->blnDebug is turned off. If no dedicated error stylsheet is supplied, then it behaves differently. It is empty by default in case it proposes any security issues.

API Tags:
Access:  public


[ Top ]
Methods
Constructor AppDoc  [line 260]

  void AppDoc( mixed &$mxdStarter, [integer $intUse = XAO_DOC_NEW]  )

AppDoc constructor

This method runs the parent constructor and sets up the xao namespace. There is no way to detect if a namespace declaration exists (to prevent duplicates). At the moment, one is inserted regardless!!! This is absolutely neccesary due to their usage by exceptions. WARNING:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: THIS MEANS THAT YOU CANNOT IMPORT EXISTING XML FILES WHICH HAVE A THE NAMESPACE xmlns:xao ALREADY DECLARED IN THE ROOT ELEMENT. The current DOMXML extension allows multiple attributes of the same name to be inserted (not good). It's namespace functions don't allow a [non-default] namespace declaration to be inserted without changing the prefix of the tag in context - so we're forced to use the dubious "set_attribute()" method instead.

Parameters:
mixed   &$mxdStarter:  starting data
integer   $intUse:  how to use the staring data

API Tags:
Access:  public


[ Top ]
ndSetStylePI  [line 291]

  bool &ndSetStylePI( uri $uriStyleSheet, [boolean $blnCheck = true]  )

Insert stylesheet processing instruction

This processing instruction is used by the transform() method if a stylesheet URI is not specifically provided to it. This method will automatically be called in the constructor if the user overrides the $this->_uriStyleSheet member attribute. It may, however, be called at any time by the user. Only one xsl stylsheet PI is maintained in the document. If it was already set at the time of the call to this method, then the new stylsheet URI will _replace_ the one in the existing PI.

Parameters:
uri   $uriStyleSheet:  path to XSL stylesheet
boolean   $blnCheck:  Whether or not to check(parse) the file.

API Tags:
Return:  success
Access:  public


[ Top ]
Send  [line 480]

  void Send( [string $strAlt = ""]  )

Send the serialised XML content of this object to the client

This function will emit the contents of this XML document as a string to the user-agent. It checks to see if the option was set to bind the error data [built up from usage of $this->Throw()] to the content. It also signals the user agent to expect text in XML format. When XAO is used as a framework, then some sort of send

Parameters:
string   $strAlt:  alternate payload which will be sent

API Tags:
Access:  public


[ Top ]
SetInternalErrorStyle  [line 369]

  void SetInternalErrorStyle( uri $uri  )

Set the name of the internal error stylsheet using in debug mode

This shouldn't need to be changed. However, if it is not appropriate for your circumstances, you may change it. Bear in mind that the uri must be specified as a relative path to the physical location of the xao DomDoc.php file.

Parameters:
uri   $uri:  Relative path to internal error stylesheet

API Tags:
Access:  public


[ Top ]
strGetPayload  [line 537]

  string strGetPayload( )

Return data that would be destined for the client (in current state)

This function is specific to AppDoc and not DomDoc because of the strAltPayload member attribute. This function can be used by the RpcController class if the user bases their request class on AppDoc. For instnace, they may want to take advantage of AppDoc's transform capabilities to convernt proprietary content into another format such as RSS.


API Tags:
Access:  public


[ Top ]
Throw  [line 554]

  void Throw( string $strErrMsg, [array $arrAttribs = null], [mixed $blnDie = false]  )

Wrapper for parent::throw() function adding ability to abort script

This function basically calls the parent function of the same name but also allows the caller to optionally abort the script if the last argument is set to true.

Parameters:
string   $strErrMsg:  Main error message
array   $arrAttribs:  A hash of name/vals which will be attributes in the exception tag

API Tags:
Access:  public


Redefinition of:
DomDoc::Throw()
Base error logger

[ Top ]
Transform  [line 387]

  void Transform( [mixed $arrCacheParams = null]  )

Prepares $this->strAltPayload with XSLT transformation result data

This function is usually called just prior to $this->Send() It is used when XSLT tranformations are required. It short-circuits the behaviour of $this->Send by populating $this->strAltPayload the results of the transformation. Note that this method requires a cirtain amount of preparation work by the user - ie. a stylsheet must be set using $this->ndSetStylePi()


API Tags:
Access:  public


[ Top ]
uriGetInternalErrorStyle  [line 352]

  uri uriGetInternalErrorStyle( )

Get the absolute system location of the internal error stylsheet.

This method is needed to enforce a location that is relative to XAO_AppDoc.php and not the last file in the call stack. See notes on $this->SetInternalErrorStyle();


API Tags:
Return:  Absolute path to internal error stylsheet.
Access:  public


[ Top ]

Documentation generated on Tue, 23 Sep 2003 18:33:53 +1000 by phpDocumentor 1.2.2