XML Processing using the Whitebeam Environment

Site Map
Application Guide
  Quick Start
  PHP and ASP
  Writing Apps
    Postgres Interface
    XML Processing
      Processing Data
      The XML JavaScript API
      Special Behaviour
      Manual Execution
      XML Macros
    Using XPath
    Binary Object
    Using HttpRequest
    Meta Data
    Memb Services
    Page Look&feel
    Message Groups
    Form Handling
Contact Whitebeam
Whitebeam Users

XML Processing using the Whitebeam Environment


The Whitebeam system contains a powerful and flexible XML parser. The features of the parser - and the reprsentation of XML documents processed by the parser - are visible within the Whitebeam project as a set of JavaScript classes:

XmlParserProvides access to the underlying parser. You can create different parsers for different activities within your Presentation Page.
XmlGenericElements in the XML tree are represented by a number of separate classes, the most common of which are XmlTag and XmlText. The Each of these specific classes share a lot of commonoality and this is documented as a 'virtual' class - XmlGeneric. It is effectively the base - or super class of each of the specific element types.
XmlTagThis is arguably the most important JavaScript class - it represents a single XML tag within a tag tree. The class inherits the behaviour of XmlGeneric and adds additional tag specific behaviour.
XmlTextRepresents a text element in the XML tree. Inherits the behaviour of XmlGeneric along with behaviour specific to text items.
XmlCommentRepresents an XML comment. Not usually processed by JavaScript - and may actually be removed from the tree as it is built by setting the parser.removeComments property to 'true'. Comment does however still have the basic behaviour inherited from the XmlGeneric class.
XmlCDataRepresents an XML CDATA section - eg <[CDATA[...]]>. comment. In many cases this cane be treated as a text element - but the parser represents it nonetheless as a separate class. XmlCData objects inherit from the XmlGeneric class.
XmlPiRepresents an XML processing instruction. In the Whitebeam environment at the moment support for processing instructions is minimal - basically the text within the element is made available as the text of the JavaScript model. Processing of that text must be done manually.comment. XmlPi does however still have the basic behaviour inherited from the XmlGeneric class.

Together the classes allow an XML parser to be create - an XML tree to be constructed from a document, that tree be represented by a collection of specialised JavaScript files. The simplest way to understand the basics of the environment is to look at a simple example:

// Create a parser.
var aParser = new XmlParser;

// Load some XML from - in this case - a file.
var data = new Binary;


// Build the XML tree. If there are no errors then the method
// returns the root of the tree. If there are errors then
// null is returned and the errors are available as
// 'aParser.errors[]'.
if (aParser.build(data)) {
   // The tree has been built - we need to execute at least
   // part of it to be useful. In this case execute the entire tree.

To understand what is happening now requires an overview of how Whitebeam processes XML data to build - and make available an XML tree. This is the subject of this tutorial!

Whitebeam release 1.3.36
(loadtime : 20ms)