Creating XML nodes

The XML data model is similar to HTML, with one important addition: XML tags may be qualified names, which are similar to compound symbols.

You must do this to use the following types and functions:

(require 'xml)

The following types and functions assume:

(require 'xml)

Procedure: make-element tag [attribute ...] child ...

Create a representation of a XML element, corresponding to

<tag attribute...>child...</tag>

The result is a TreeList, though if the result context is a consumer the result is instead "written" to the consumer. Thus nested calls to make-element only result in a single TreeList. More generally, whether an attribute or child is includded by copying or by reference is (for now) undefined. The tag should currently be a symbol, though in the future it should be a qualified name. An attribute is typically a call to make-attribute, but it can be any attribute-valued expression.

(make-element 'p
	      "The time is now: "
	      (make-element 'code (make <java.util.Date>)))

Procedure: element-name element

Returns the name (tag) of the element node, as a symbol (QName).

Procedure: make-attribute name value...

Create an "attribute", which is a name-value pair. For now, name should be a symbol.

Procedure: attribute-name element

Returns the name of the attribute node, as a symbol (QName).

Type: comment

Instances of this type represent comment values, specifically including comments in XML files. Comment nodes are currently ignored when printing using Scheme formatting, though that may change.

Constructor: comment comment-text

Create a comment object with the specified comment-text.

Type: processing-instruction

Instances of this type represent “processing instructions”, such as may appear in XML files. Processing-instruction nodes are currently ignored when printing using Scheme formatting, though that may change.

Constructor: processing-instruction target contents

Crreate a processing-instruction object with the specified target (a simple symbol) and contents (a string).