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 tomake-element
only result in a singleTreeList
. More generally, whether anattribute
orchild
is includded by copying or by reference is (for now) undefined. Thetag
should currently be a symbol, though in the future it should be a qualified name. Anattribute
is typically a call tomake-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).
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
.
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) andcontents
(a string).