#
Storing AST Objects as XML (XmlChan)

XMLhttp://www.w3.org/XML/ is fast becoming the standard format for passing structured data around the internet, and much general purpose software has been written for tasks such as the parsing, editing, display and transformation of XML data. The XmlChanXmlChan class (a specialised form of ChannelChannel) provides facilities for storing AST objects externally in the form of XML documents, thus allowing such software to be used.

The primary XML format used by the XmlChan class is a fairly close transliteration of the AST native format produced by the basic Channel class. Currently, there is no DTD or schema defining the structure of data produced in this format by an XmlChan. The following is a native AST representation of a simple 1-D FrameFrame (including comments and with the FullFull attribute set to zero so that some default attribute values are included as extra comments):

276#276

The corresponding XmlChan output would look like:

277#277

Notes:

1. The AST class name is used as the name for an XML element which contain a description of an AST object.

2. AST attributes are described by XML elements with the name “_attribute”. Unfortunately, the word “attribute” is also used by XML to refer to a “name=value” pair within an element start tag. So for instance, the “TitleTitle” attribute of the AST Frame object is described within an XML element with name “_attribute” in which the XML attribute “name” has the value “Title”, and the XML attribute “value” has the value “1-d coordinate system”. The moral is always to be clear clear about the context (AST or XML) in which the word attribute is being used!

3. The XML includes comments both as XML attributes with the name “desc”, and as separate comment tags.

4. Elements which describe default values are identified by the fact that they have an XML attribute called “default” set to the value “true”. These elements are ignored when being read back into an XmlChan.

5. The outer-most XML element of an AST object will set the default namespace to `http://www.starlink.ac.uk/ast/xml/` which will be inherited by all nested elements.

The XmlChan class changes the default value for the CommentComment and Full attributes (inherited from the base Channel class) to zero and -1, resulting in terse output by default. With the default values for these attributes, the above XML is reduced to the following:

278#278

The XmlChan class uses the SkipSkip attributes very similarly to the Channel class. If Skip is zero (the default) then an error will be reported if the text supplied by the source function does not begin with an AST ObjectObject. If Skip is non-zero, then initial text is skipped over without error until the start of an AST object is found. this allows an AST object to be located within a larger XML document.

Subsections

- Reading IVOA Space-Time-Coordinates XML (STC-X) Descriptions