Object Reference Chart
[ Hide descriptions ][
Simple output ]
Object::XMLObject()
Current version is: 2.8.5
This object was designed to achieve the following goals:
- Easy and consistent access to XML data in ASP environments, including errorhandling
- Flexible transformations with XSLT
- Make the XSLProcessor and caching mechanisms accessible with minimum extra efforts
- Enabling a one-page-only solution to the somewhat cumbersome process of setting up the XSLProcessor for passing parameters into a stylesheet and changing them on-the-fly.
Constructors
XMLObject()
-
Objectcreation only. Use this if you need to set parameters (ie. .async)
before loading document(s).
XMLObject(xmlfileSpec)
-
Creates the object and loads the specified XML from file or XMLstring.
XMLObject(xmlfileSpec, stylesheetSpec)
-
Loads an XML document, a stylesheet and performs a .transform(), leaving the result in .output.
XMLObject(xmlfileSpec, stylesheetSpec, bitflags)
-
Use the third argument, to define options. Using bitflags you can specify whether you want to use the XSLTemplate caching mechanism
(XMLOBJ_USE_XSLTEMPLATE) and/or, signal that the automatic call to .transform() should not
be executed (XMLOBJ_NO_TRANSFORM).
XMLObject(xmlfileSpec, stylesheetSpec, "QryStrVar->StyleSheetVar;...")
-
To gain the full power from XMLObject(), use this constructor as it allows you to pass
QueryString parameters to the stylesheet, as if it was an ASP page. Using this constructor
also invokes the use of Application variables, which makes the subsequent transforms much faster.
If you change the XML file or the stylesheet you will need to call the ASP page with the
following QueryString: reloadprocessors=yes, to be able to see any changes you've made
to the XML/XSL files.
quickTransformXML(xmlfileSpec, stylesheetSpec
[, XMLOBJ_NO_ERRORS]
)
-
A shortcut to generating the object and outputting results. Simply returns the transformed result. Use XMLOBJ_NO_ERRORS to
suppress errors from the result.
Properties
.async
- load method for subsequent .loadX*Ldoc() calls. Defaults to false.
.error
- flag
.errorDesc
- if .error is true, this holds the description(s)
.input
- XML document (if loaded)
.output
- result of .transform()
.processor
- The XSLProcessor, containing the compiled stylesheet
.status
- debugging property, showing the current status
.stylesheet
- XSL document (or a 2nd XML doc.)
.useXPath
- When true (default), the selection language in queries to the .input document is XPath.
.validateOnParse
- controls validation while loading the documents. Defaults to true.
.xml
- shortcut to .input.xml
.xsl
- shortcut to .stylesheet.xml
Methods
.addObject(oObject, NamespaceURI)
-
Very advanced. Provides access to an object via Namespace logic, thus
providing enhancements to the XSLT engine.
.addParameter(sParameter, someValue)
-
Transfers a value to a parameter in the XSLTemplate. This is handled automatically via the QueryString,
but provided in the interface for advanced users. (If you need to pass the value of a Form field to the
XSLTemplate you would use this method.)
.appendToNode(xmlNodeSpec, sXPath)
-
Appends the node in xmlNodeSpec (URL, filename or XMLString) to the node found with the XPath expression.
.appendToRoot(xmlNodeSpec
[, sXPath]
)
-
Appends the node in xmlNodeSpec (URL, filename or XMLString) to the root node of the .input document.
Optionally, you can specify an XPath to select a specific node in the appended document.
.getNodeText(XPath)
-
Returns the text value of the node found with the XPath expression from the .input document.
.loadXMLdoc(sXML)
- Loads a new XML document into .input
.loadXSLdoc(sXML)
- Loads a new XSL document into .stylesheet
.removeNode(XPath)
-
Removes the node found with the XPath expression from the .input document.
.replaceNode(xmlNodeSpec, XPath)
-
Replaces the node found with the XPath
expression in the .input document with a new node created from the xmlNodeSpec parameter,
which take an URL, a filename, or an XMLString.
.saveXML(sPath)
-
Allows you to save the XML document (the document in the .input property).
The argument must be the full physical path to the file.
.setVersion(sVersion)
-
changes ProgIDs used for MSXML objects.
(Necessary if you need the version dependent objects in MSXML3.0)
Call with "3.0" to use version dependent ProgIDs.
.transform()
-
transforms the .input with the .stylesheet and
puts result in .output.
.validate(ERR_CHECK_STYLESHEET|ERR_CHECK_DOCUMENT|ERR_CHECK_BOTH
)
-
Validates the document(s) — For an XML document to be called valid, it has to be well-formed AND have a DTD/Schema to which it conforms.
Constants
Array Indexes:
XMLOBJ_PROC_QRYNAME
= 0
XMLOBJ_PROC_XSLNAME
= 1
Bitflags:
XMLOBJ_USE_XSLTEMPLATE
= 0x01
XMLOBJ_NO_TRANSFORM
= 0x02
XMLOBJ_NO_ERRORS
= 0x04
XMLOBJ_NOCACHE_XML
= 0x10
XMLOBJ_NOCACHE_XSL
= 0x20
XMLOBJ_TRANSFER_OPERATOR
= "->"
Debugging:
XMLOBJ_ALWAYS_RELOAD_PROCESSORS
= false
Defaults:
XMLOBJ_DEFAULT_VERSION
= "default"
- The default version of MSXML to use
Error IDs:
XMLOBJERROR_INVALID_ARGUMENT
XMLOBJERROR_INTERNAL_ERROR
XMLOBJERROR_VERSION_UNSUPPORTED
XMLOBJERROR_CANNOT_CHANGE_VERSION
XMLOBJERROR_NOT_IMPLEMENTED
XMLOBJERROR_PROCESSOR_NOT_READY
XMLOBJERROR_NO_DOCUMENT
XMLOBJERROR_NO_STYLESHEET
XMLOBJERROR_NO_PROCESSOR
XMLOBJERROR_MISSING_DOCS
XMLOBJERROR_OBJECT_NOT_READY
XMLOBJERROR_NODE_NOT_FOUND
RESID_NO_DESCRIPTION
Object States:
XMLOBJSTATE_EMPTY
XMLOBJSTATE_LOADING
XMLOBJSTATE_READY
XMLOBJSTATE_ERROR
ProgIDs:
DEF_XMLDOMDOCUMENT
= "MSXML2.DOMDocument"
DEF_XMLFREETHREADED
= "MSXML2.FreeThreadedDOMDocument"
DEF_XSLTEMPLATE
= "MSXML2.XSLTemplate"
DEF_SERVERXMLHTTP
= "MSXML2.ServerXMLHTTP"
PROGID_DOMDOCUMENT_30
= "MSXML2.DOMDocument.3.0"
PROGID_FREETHREADED_30
= "MSXML2.FreeThreadedDOMDocument.3.0"
PROGID_XSLTEMPLATE_30
= "MSXML2.XSLTemplate.3.0"
PROGID_SERVERXMLHTTP_30
= "MSXML2.ServerXMLHTTP.3.0"
PROGID_DOMDOCUMENT_40
= "MSXML2.DOMDocument.4.0"
PROGID_FREETHREADED_40
= "MSXML2.FreeThreadedDOMDocument.4.0"
PROGID_XSLTEMPLATE_40
= "MSXML2.XSLTemplate.4.0"
PROGID_SERVERXMLHTTP_40
= "MSXML2.ServerXMLHTTP.4.0"
Validation:
ERR_CHECK_STYLESHEET
ERR_CHECK_DOCUMENT
ERR_CHECK_BOTH
ERR_CHECK_PROCESSOR
ERR_CHECK_ALL
XMLDOM:
NODE_ELEMENT
= 1
NODE_ATTRIBUTE
= 2
NODE_TEXT
= 3
NODE_CDATA_SECTION
= 4
NODE_ENTITY_REFERENCE
= 5
NODE_ENTITY
= 6
NODE_PROCESSING_INSTRUCTION
= 7
NODE_COMMENT
= 8
NODE_DOCUMENT
= 9
NODE_DOCUMENT_TYPE
= 10
NODE_DOCUMENT_FRAGMENT
= 11
NODE_NOTATION
= 12
Author: Chriztian Steinmeier (chriztian@steinmeier.dk)