5 XML Infoset Mapping

WebIt! implements an abstract datatype for the XML Infoset, in terms of the API described in this section. The concrete datatype used by this API is SXML.

5.1 Normalized and Non-Normalized SXML

5.1.1 normalized-sxml

parameter

By default, WebIt! functions and syntax can process non-normalized SXML. However, there is a performance penalty for this. normalized-sxml may be used to restrict WebIt! to processing a particular style of normalized SXML. The default value of #f enables processing of non-normalized SXML. Set this parameter to #t to restrict WebIt! to normalized SXML.

5.2 Constructing and Analyzing XML Document Nodes

5.2.1 make-xml-document

function

make-xml-document :: list-of-nodes -> xml-document

This function construction a document node from a list of nodes. The list should include exactly one xml-element node.

5.2.2 xml-document?

function

xml-document? :: node -> boolean

Returns #t if its argument is an xml-document node, otherwise #f.

5.2.3 xml-document-dtd-info

function

xml-document-dtd-info :: xml-document -> xml-dtd-info

Returns the document's xml-dtd-info, if one is present, otherwise #f.

5.2.4 xml-document-content

function

xml-document-content :: xml-document -> xml-element

Returns the document's root element.

5.2.5 xml-document-body

function

xml-document-content :: xml-document -> nodeset

Returns a list of the document's body nodes.

5.3 Constructing and Analyzing XML Element Nodes

5.3.1 make-xml-element

function

make-xml-element :: tag attribute-list node-list -> xml-element

The element tag is a symbol.

The attribute-list is a list of attribute nodes: a list of an attribute tag and a string, number or boolean.

A node-list is a (possibly null) list of XML nodes.

5.3.2 make-xml-element/ns

function

make-xml-element/ns :: tag ns-list attribute-list node-list -> xml-element

The element tag, tag, is a symbol.

ns-list is a list of namespace bindings. Each namespace binding is a list of a namespace uri (string) and a prefix (symbol).

The attribute-list is a list of attribute nodes: a list of an attribute tag and a string, number or boolean.

A node-list is a (possibly null) list of XML nodes.

5.3.3 xml-element?

function

xml-element? :: node -> boolean

Returns #t if its argument is an xml-element node, otherwise #f.

5.3.4 xml-element-tag

function

xml-element-tag :: xml-element -> symbol

Returns the tag (symbol) of an element node. This tag is either the local name of the element (for locally named element), or the concatenation of the namespace URI to which the element belongs and the element's local name, separated by a colon.

5.3.5 xml-element-local-name

function

xml-element-local-name :: xml-element -> symbol

Returns the local-name (symbol) of an element node.

5.3.6 xml-element-ns-uri

function

xml-element-local-name :: xml-element -> symbol

Returns the namespace URI to which the element belongs, #f.

5.3.7 xml-element-ns-list

function

xml-element-ns-list :: xml-element -> (listof xml-namespace-binding)

Returns a list of namespace prefix bindings associated with this element.

5.3.8 xml-element-attributes

function

xml-element-attributes :: xml-element -> (listof xml-attribute)

Returns a list of attributes of this element.

5.3.9 xml-element-contents

function

xml-element-contents :: xml-element -> (listof node)

Returns a nodeset of the children of this element.

5.4 Constructing and Analyzing XML Attribute Nodes

5.4.1 make-xml-attribute

function

make-xml-attribute :: tag value -> (list-of symbol string|number|boolean)

The attribute tag is a symbol.

The value of an attribute may be a string, number or boolean.

5.4.2 xml-attribute-tag

function

xml-attribute-tag :: xml-attribute -> symbol

Returns the tag (symbol) of an attribute node. This tag is either the local name of the attribute (for locally named attributes), or the concatenation of the namespace URI to which the attribute belongs and the attribute's local name, separated by a colon.

5.4.3 xml-attribute-local-name

function

xml-attribute-local-name :: xml-attribute -> symbol

Returns the local-name (symbol) of an attribute node.

5.4.4 xml-attribute-ns-uri

function

xml-attribute-local-name :: xml-attribute -> symbol

Returns the namespace URI to which the attribute belongs, #f.

5.4.5 xml-attribute-value

function

xml-attribute-value :: xml-attribute -> string|number|boolean

Returns the value of an attribute node.

5.5 Constructing and Analyzing XML Comment Nodes

5.5.1 make-xml-comment

function

make-xml-comment :: string -> xml-comment

This function constructs an xml-comment object with its argument as the comment text.

5.5.2 xml-comment?

function

xml-comment? :: node -> boolean

This function returns #t if its argument is an xml-comment, otherwise #f.

5.5.3 xml-comment-text

function

xml-comment-text :: xml-comment -> string

Returns the text of an xml-comment node.

5.6 Constructing and Analyzing XML Processing Instruction Nodes

5.6.1 make-xml-pi

function

make-xml-pi :: symbol string -> xml-pi

This function has to arguments: a PI target (symbol) and PI text (a string). Returns a new xml-pi object.

5.6.2 xml-pi?

function

xml-pi? :: node -> boolean

This function returns #t if its argument is an xml-comment, otherwise #f.

5.6.3 xml-pi-target

function

xml-pi-target :: xml-pi -> symbol

This function returns it's argument's PI target.

5.6.4 xml-pi-text

function

xml-pi-text :: xml-pi -> symbol

This function returns it's argument's PI text.

5.7 Constructing and Analyzing XML Entity Nodes

5.7.1 make-xml-entity

function

make-xml-entity :: string string -> xml-entity

This function takes two arguments of type string: a public-id and a system-id, and a returns a new xml-entity object.

5.7.2 xml-entity?

function

xml-entity? :: node -> boolean

This function returns #t if its argument is an xml-entity, otherwise #f.

5.7.3 xml-entity-public-id

function

xml-entity-public-id :: xml-entity -> string

This function returns it's argument's public-id.

5.7.4 xml-entity-system-id

function

xml-entity-system-id :: xml-entity -> string

This function returns it's argument's system-id.

5.8 Constructing and Analyzing XML Namespace Binding Nodes

5.8.1 make-xml-ns-binding

function

make-xml-ns-binding :: symbol string -> (list symbol string)

This function takes two arguments: a namespace prefix (symbol) and a namespace URI (string), and returns a new namespace prefix binding.

5.8.2 xml-ns-binding-prefix

function

xml-ns-binding-prefix :: (list symbol string) -> symbol

This function returns the namespace prefix from its argument.

5.8.3 xml-ns-binding-ns-url

function

xml-ns-binding-ns-url :: (list symbol string) -> string

This function returns the namespace URI from its argument.

5.9 Constructing and Analyzing DTD Information Nodes

5.9.1 make-xml-dtd-info

function

make-xml-dtd-info :: symbol string -> xml-dtd-info

This function takes two arguments: a name (symbol) and a system (string). Returns a new xml-dtd-info object.

5.9.2 xml-dtd-info?

function

xml-dtd-info? :: node -> boolean

This function returns #t if its argument is an xml-dtd-info or xml-dtd-info/public object, otherwise #f.

5.9.3 xml-dtd-info-name

function

xml-dtd-info-name :: xml-dtd-info -> symbol

This function returns it's argument's name field.

5.9.4 xml-dtd-info-system

function

xml-dtd-info-system :: xml-dtd-info -> string

This function returns it's argument's system field.

5.9.5 make-xml-dtd-info/public

function

make-xml-dtd-info/public :: symbol string string -> xml-dtd-info/public

This function takes three arguments: a name (symbol), a system (string), and a public (string). Returns a new xml-dtd-info/public object.

5.9.6 xml-dtd-info/public?

function

xml-dtd-info/public? :: node -> boolean

This function returns #t if its argument is an xml-dtd-info/public, otherwise #f.

5.9.7 xml-dtd-info/public-public

function

xml-dtd-info/public-public :: xml-dtd-info/public -> string

This function returns it's argument's public field.

5.10 Miscellaneous

5.10.1 nodeset?

function

nodeset? :: any -> boolean

This function returns #t if its argument is a list which does not begin with a symbol, otherwise #f.

5.10.2 has-attribute?

function

has-attribute? :: symbol (listof xml-attribute) -> (xml-attribute | #f)

This function searches a list of attributes for the for the requested attribute. Returns the matching attribute, otherwise #f.

5.10.3 bind-namespaces

syntax

This form is used to introduce namespace prefix bindings, and to attach these bindings to an xml-element object.

The grammar for bind-namespaces is:

(bind-namespaces ([prefix-symbol uri-string] ...)
   expression)

Expression must evaluate to an xml-element. bind-namespaces returns a new xml-element object, with the new namespace prefix bindings.

 

 

Last modified: Sunday, April 24th, 2005 2:52:27pm
HTML generated using WebIt!.