SDOM MANUAL-EDITION 0.5.1

Table of Contents


Next: , Up: (dir)

The SDOM Manual

This manual describes the SDOM Scheme library.

Copyright © 2011 Julian Graham.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

This reference manual documents SDOM, a Scheme module designed to be a complete implementation of the W3C's Document Object Model recommendation. It contains descriptions of the various aspects of the SDOM API and explains some of SDOM's inner workings and how it can be integrated with other Scheme modules.

This Info file contains a development edition of the reference manual, corresponding to the current development release of SDOM.

Appendices

Indices

Table of Contents


Next: , Previous: Top, Up: Top

1 Introduction

SDOM aims to provide a complete Scheme implementation of the W3C's Document Object Model API recommendation. This document contains a description of the SDOM API, including explanatory notes for cases in which the SDOM API diverges significantly from the W3C recommendation. In general, an attempt has been made to replicate the recommendation's API method-for-method, but because of inherent differences between rules and conventions of the Scheme language and those of the languages for which the DOM recommendation seems to have been initially intended, we believe that some of the changes we made were requisite, if not actually more desirable than the original. Some of the major differences are discussed in the following sections.


Next: , Previous: Introduction, Up: Top

2 Adherence to W3C DOM


Up: Adherence to W3C DOM

2.1 Naming conventions

The DOM recommendation assumes an object-oriented language similar in syntax to C++ or Java, and, as such, follows the naming conventions of those languages in the API it describes. Given the obvious differences between Scheme and, say, Java, the naming conventions favored by SDOM are bit different.

As a convenience to the reader, this manual includes, for each part of the SDOM API that maps to a particular bit of the DOM API, the name of the DOM API method or constant to which it corresponds.


Next: , Previous: Adherence to W3C DOM, Up: Top

3 Document parsing

There are two ways that SDOM can translate an existing XML document into a format in which it can be manipulated using SDOM's API: SDOM can add the necessary book-keeping information to a document that has already been parsed by SSAX; or it can read and parse the XML directly from a Scheme input port, using a customized version of the SSAX parser. This latter way is preferrable, since it preserves Document Type Declarations and information about entities.

— Function: sdom:sxml->sdom sxml-doc

Creates and returns a deep copy of the SXML tree sxml-doc, adding to it the required book-keeping information and node annotations.

— Function: sdom:xml->sdom port namespace-decls

Reads an XML document as a string from the input port port, parsing it into an SXML-compatible SDOM document. If namespace-decls is non-null, it should be a list of

          PREFIX . NAMESPACE-URI

...where PREFIX is a symbol to be used as XML namespace shorthand for the string NAMESPACE-URI, and will be used to resolve namespace prefixes encountered during parsing. If the available SSAX implementation exports the make-parser macro, a customized version the SSAX parser that preserves DTD and entity information will be used; otherwise the behavior will be identical to that of sdom:sxml->sdom.


Next: , Previous: Document parsing, Up: Top

4 Implementation details


Up: Implementation details

4.1 Namespace management

The default behavior of the SXML ssax:xml->sxml parser with regard to XML namespaces is to resolve any prefixes it finds to their corresponding namespace URIs (provided these are specified by the document) and then replace all prefixes with either a symbolic form of the URI or a so-called "user namespace shortcut," depending on whether or not a list of shortcuts is specified at parse time. The original prefix is not made available as part of the namespace mapping in the resulting S-list.

Because this behavior is the default for SXML (it can be changed, but doing so is not straightforward) and because DOM does not explicitly discuss the use of such shortcuts, SDOM treats them as being interchangeable with coventional XML namespace prefixes. This behavior can be modified on a per-document basis with a call to sdom:set-dom-configuration-parameter!, setting the option "sdom:prefer-orig-prefix" to "true." If this option is set, SDOM functions that manipulate prefixes will look for the original prefix in the namespace declaration before looking at the user namespace shortcut.

For example, a typical namespace declaration in an SXML document looks like this:

     (*NAMESPACES* (foo "http://www.foo.bar.com/"))

provided you've invoked ssax:xml->sxml something like this:

     (ssax:xml->sxml (open-input-file "baz.xml")
                     '((foo "http://www.foo.bar.com/"))))

where baz.xml contains:

     <?xml version="1.0"?>
     <doc xmlns:baz="http://www.foo.bar.com/">
       <baz:element/>
     </doc>

(If you don't provide the mapping of shortcuts to URIs, you won't, by default, get any namespace declarations, and all prefixes will be translated to symbolized URIs – baz:element will become http://www.foo.bar.com:element.) So, by default, if you evaluate sdom:lookup-prefix for "foo" on the appropriate node, you'll get "http://www.foo.bar.com/," even though foo may not actually have been a prefix. Likewise, a call to sdom:lookup-namespace-uri on "http://www.foo.bar.com/" will return foo.

Now let's say you've constructed your SXML parser so that it preserves prefixes and stores them in namespace declarations, which now look more like this:

     (*NAMESPACES* (foo "http://www.foo.bar.com/" baz))

If you've set sdom:prefer-orig-prefix to true, then a call to sdom:lookup-prefix for both foo and baz will return "http://www.foo.bar.com/." A call to sdom:lookup-namespace-uri on "http://www.foo.bar.com/" will return baz. (If the original prefix is not available, sdom:lookup-namespace-uri will return foo instead.)


Next: , Previous: Implementation details, Up: Top

5 Event handling


Next: , Up: Event handling

5.1 Event API


Previous: Event API, Up: Event handling

5.2 Event property reference


Up: Event property reference

5.2.1 Properties for Events

— sdom:type:
— Event.type:

— sdom:target:
— Event.target:

— sdom:current-target:
— Event.currentTarget:

— sdom:event-phase:
— Event.eventPhase:

— sdom:bubbles:
— Event.bubbles:

— sdom:cancelable:
— Event.cancelable:

— sdom:time-stamp:
— Event.timeStamp:

— sdom:namespace-uri:
— Event.namespaceURI:


Next: , Up: Properties for Events
5.2.1.1 Properties for Custom Events


Next: , Previous: Properties for Custom Events, Up: Properties for Events
5.2.1.2 Properties for UI Events

— sdom:view:
— UIEvent.view:

— sdom:detail:
— UIEvent.detail:


Previous: Properties for UI Events, Up: Properties for Events
5.2.1.3 Properties for Mutation Events

— sdom:related-node:
— MutationEvent.relatedNode:

— sdom:prev-value:
— MutationEvent.prevValue:

— sdom:new-value:
— MutationEvent.newValue:

— sdom:attr-name:
— MutationEvent.attrName:

— sdom:attr-change:
— MutationEvent.attrChange:


Next: , Previous: Event handling, Up: Top

6 Type reference


Next: , Up: Type reference

6.1 Node types

These are the constants that will be returned by a request to resolve the type of node. They can also be used in calls to sdom:create-node. Since the DOM recommendation appears to consider these mappings to be invariant (though not exhaustive) it is probably safe to use the numerical values in your code; the symbols are provided for your convenience.

— Variable: sdom:node-type-element
— Variable: ELEMENT_NODE

(constant value = 1)

— Variable: sdom:node-type-attr
— Variable: ATTRIBUTE_NODE

(constant value = 2)

— Variable: sdom:node-type-text
— Variable: TEXT_NODE

(constant value = 3)

— Variable: sdom:node-type-cdata-section
— Variable: CDATA_SECTION_NODE

(constant value = 4)

— Variable: sdom:node-type-entity-reference
— Variable: ENTITY_REFERENCE_NODE

(constant value = 5)

— Variable: sdom:node-type-entity
— Variable: ENTITY_NODE

(constant value = 6)

— Variable: sdom:node-type-processing-instruction
— Variable: PROCESSING_INSTRUCTION_NODE

(constant value = 7)

— Variable: sdom:node-type-comment
— Variable: COMMENT_NODE

(constant value = 8)

— Variable: sdom:node-type-document
— Variable: DOCUMENT_NODE

(constant value = 9)

— Variable: sdom:node-type-document-type
— Variable: DOCUMENT_TYPE_NODE

(constant value = 10)

— Variable: sdom:node-type-document-fragment
— Variable: DOCUMENT_FRAGMENT_NODE

(constant value = 11)

— Variable: sdom:node-type-notation
— Variable: NOTATION_NODE

(constant value = 12)


Next: , Previous: Node types, Up: Type reference

6.2 Event types

— Variable: sdom:event-load
— Variable: load

— Variable: sdom:event-unload
— Variable: unload

— Variable: sdom:event-abort
— Variable: abort

— Variable: sdom:event-error
— Variable: error

— Variable: sdom:event-select
— Variable: select

— Variable: sdom:event-change
— Variable: change

— Variable: sdom:event-submit
— Variable: submit

— Variable: sdom:event-reset
— Variable: reset

— Variable: sdom:event-resize
— Variable: resize

— Variable: sdom:event-scroll
— Variable: scroll

— Variable: sdom:event-dom-activate
— Variable: DOMActivate

— Variable: sdom:event-dom-focus-in
— Variable: DOMFocusIn

— Variable: sdom:event-dom-focus-out
— Variable: DOMFocusOut

— Variable: sdom:event-text-input
— Variable: textInput

— Variable: sdom:event-click
— Variable: click

— Variable: sdom:event-mousedown
— Variable: mousedown

— Variable: sdom:event-mouseup
— Variable: mouseup

— Variable: sdom:event-mouseover
— Variable: mouseover

— Variable: sdom:event-mousemove
— Variable: mousemove

— Variable: sdom:event-mouseout
— Variable: mouseout

— Variable: sdom:event-keydown
— Variable: keydown

— Variable: sdom:event-keyup
— Variable: keyup

— Variable: sdom:event-dom-subtree-modified
— Variable: DOMSubtreeModified

— Variable: sdom:event-dom-node-inserted
— Variable: DOMNodeInserted

— Variable: sdom:event-dom-node-removed
— Variable: DOMNodeRemoved

— Variable: sdom:event-dom-node-removed-from-document
— Variable: DOMNodeRemovedFromDocument

— Variable: sdom:event-dom-node-inserted-into-document
— Variable: DOMNodeInsertedIntoDocument

— Variable: sdom:event-dom-element-name-changed
— Variable: DOMElementNameChanged

— Variable: sdom:event-dom-attribute-name-changed
— Variable: DOMAttrNameChanged


Next: , Previous: Event types, Up: Type reference

6.3 Exception types

— Variable: sdom:exception-code-index-size-err
— Variable: INDEX_SIZE_ERR

(constant value = 1)

— Variable: sdom:exception-code-domstring-size-err
— Variable: DOMSTRING_SIZE_ERR

(constant value = 2)

— Variable: sdom:exception-code-hierarchy-request-err
— Variable: HIERARCHY_REQUEST_ERR

(constant value = 3)

— Variable: sdom:exception-code-wrong-document-err
— Variable: WRONG_DOCUMENT_ERR

(constant value = 4)

— Variable: sdom:exception-code-invalid-character-err
— Variable: INVALID_CHARACTER_ERR

(constant value = 5)

— Variable: sdom:exception-code-no-data-allowed-err
— Variable: NO_DATA_ALLOWED_ERR

(constant value = 6)

— Variable: sdom:exception-code-no-modification-allowed-err
— Variable: NO_MODIFICATION_ALLOWED_ERR

(constant value = 7)

— Variable: sdom:exception-code-not-found-err
— Variable: NOT_FOUND_ERR

(constant value = 8)

— Variable: sdom:exception-code-not-supported-err
— Variable: NOT_SUPPORTED_ERR

(constant value = 9)

— Variable: sdom:exception-code-inuse-attribute-err
— Variable: INUSE_ATTRIBUTE_ERR

(constant value = 10)

— Variable: sdom:exception-code-invalid-state-err
— Variable: INVALID_STATE_ERR

(constant value = 11)

— Variable: sdom:exception-code-syntax-err
— Variable: SYNTAX_ERR

(constant value = 12)

— Variable: sdom:exception-code-invalid-modification-err
— Variable: INVALID_MODIFICATION_ERR

(constant value = 13)

— Variable: sdom:exception-code-namespace-err
— Variable: NAMESPACE_ERR

(constant value = 14)

— Variable: sdom:exception-code-invalid-access-err
— Variable: INVALID_ACCESS_ERR

(constant value = 15)

— Variable: sdom:exception-code-validation-err
— Variable: VALIDATION_ERR

(constant value = 16)

— Variable: sdom:exception-code-type-mismatch-err
— Variable: TYPE_MISMATCH_ERR

(constant value = 17)


Previous: Exception types, Up: Type reference

6.4 User data event types

— Variable: sdom:user-data-event-node-cloned
— Variable: NODE_CLONED

(constant value = 1)

— Variable: sdom:user-data-event-node-imported
— Variable: NODE_IMPORTED

(constant value = 2)

— Variable: sdom:user-data-event-node-deleted
— Variable: NODE_DELETED

(constant value = 3)

— Variable: sdom:user-data-event-node-renamed
— Variable: NODE_RENAMED

(constant value = 4)

— Variable: sdom:user-data-event-node-adopted
— Variable: NODE_ADOPTED

(constant value = 5)


Next: , Previous: Type reference, Up: Top

7 SDOM API reference

The following functions are described in terms of their respective counterparts in the W3C DOM recommendation; you should refer to that document for more thorough discussion of the expected behavior.

On the other hand, this implementation does not adhere strictly to the organization of interfaces in the recommendation, so the following groupings are based on the purpose of the functions they contain, not on their position within the DOM hierarchy.


Next: , Up: SDOM API reference

7.1 Node creation

— Function: sdom:create-document rootname dtd rootns
— Function: DOMImplementation.createNode

Returns a new document node with document type given by dtd and document element with QName rootname and namespace rootns. dtd may be null if no document type is required; if rootname is null, the resulting document will have no document element.

— Function: sdom:create-document-type qname public-id system-id

— Function: sdom:create-node document node-type args...

Creates and returns a new node of type node-type, whose owner-document is document. This function can be used to create all non-Document node types, according to the following table, which gives the significance and required types of the optional arguments according to node-type.

Node type Arg1 Arg2
sdom:node-type-element qname, as string [namespace, as string]
sdom:node-type-attr qname, as string [namespace, as string]
sdom:node-type-text content, as string
sdom:node-type-cdata-section content, as string
sdom:node-type-entity-reference entity name, as string
sdom:node-type-entity
sdom:node-type-processing-instruction target, as string data, as string
sdom:node-type-comment value, as string
sdom:node-type-document-type
sdom:node-type-document-fragment
sdom:node-type-notation

For example, to create a new Element node, you could use either of the following expressions:

          (sdom:create-node doc sdom:node-type-element "xhtml:p"
                            "http://www.w3.org/1999/xhtml")
          (sdom:create-node doc sdom:node-type-element "p")


Next: , Previous: Node creation, Up: SDOM API reference

7.2 Node manipulation

— Function: sdom:insert-before! parent new-node [ref-node]
— Function: Node.insertBefore

Inserts new-node as a new child node of parent. If ref-node is specified, this function will insert new-node such that it precedes ref-node as a child of parent in the document order; otherwise its behavior will be identical to that of sdom:append-child!.

Errors:

Events:

— Function: sdom:insert-after! parent new-node [ref-node]
— Function: Node.insertAfter

Inserts new-node as a new child node of parent. If ref-node is specified, this function will insert new-node such that it follows ref-node as a child of parent in the document order; otherwise its behavior will be identical to that of sdom:append-child!.

Errors:

Events:

— Function: sdom:append-child! parent node
— Function: Node.appendChild

Appends node as a new child of parent, returning node. If node has a non-null parent, it is first removed.

Errors:

— Function: sdom:remove-child! parent node
— Function: Node.removeChild

— Function: sdom:replace-child! parent new-child old-child
— Function: Node.replaceChild

Throws sdom:exception-code-not-found-err if old-child is not a child of parent

— Function: sdom:clone-node node deep
— Function: Node.clone

— Function: sdom:adopt-node! document node
— Function: Document.adoptNode

Destructively adopts node into document. node is removed as a child of any parent it may have; the sdom:owner-document property for node is set to document.

Errors:

— Function: sdom:import-node document node deep
— Function: Document.importNode


Next: , Previous: Node manipulation, Up: SDOM API reference

7.3 Node predicates

— Function: sdom:same-node? node1 node2
— Function: Node.isSameNode

Returns #t if node1 and node2 are the same, according to the rules set forth in the W3C recommendation for node sameness, #f otherwise. In general in SDOM, two nodes are the same if they are equal under the eq? predicate or have internal representations that are the same under the eq? predicate.

— Function: sdom:equal-node? node1 node2
— Function: Node.equalNode

Returns #t if node1 and node2 are equal, according to the rules set forth in the W3C recommendation for node equality, #f otherwise.

— Function: sdom:has-child-nodes? node
— Function: Node.hasChildNodes

Returns #t if node has child nodes, #f otherwise.

— Function: sdom:supported? node feature version
— Function: Node.isSupported

— Function: sdom:compare-document-position node1 node2
— Function: Node.compareDocumentPosition


Next: , Previous: Node predicates, Up: SDOM API reference

7.4 Properties and configuration


Up: Properties and configuration

7.4.1 DOM Configuration Parameters

DOM configuration parameters control the behavior of a DOM implementation for a particular document during document normalization. They can be retrieved and set for a particular document, but SDOM does not consider them to be DOM properties that are stored in the document tree itself; rather, they are considered to be “out-of-band” data and are maintained in a separate hash table that is keyed on document nodes. This means they will not be available across loads and saves of the document to which they are attached.

SDOM implements the following DOM configuration parameters, which can be modified for a particular document using the functions described below (see the DOM recommendation for information on their meaning during normalization):

Name Supported values Default
“canonical-form” #f #f
“cdata-sections” #t #f #t
“check-character-normalization” #f #f
“comments” #t #f #t
“datatype-normalization” #f #f
“element-content-whitespace” #t #t
“entities” #t #f #t
“error-handler” DEFAULT_HANDLER HANDLER_PROCEDURE
“infoset” #f #f #t
“namespaces” #t #t
“namespace-declarations” #f #t #t
“normalize-characters” #f #f
“split-cdata-sections” #t #f #t
“strict-error-checking” #t #f #t
“validate” #f #f
“validate-if-schema” #f #f
“well-formed” #t #t
“sdom:prefer-orig-prefix” #f #f #t
“sdom:resolve-new-prefixes” #t #f #t

— Function: sdom:get-dom-config-parameter document param
— Function: DOMConfiguration.getParameter

Return the value of the configuration parameter param for the document document.

Errors:

— Function: sdom:set-dom-config-parameter! document param value
— Function: DOMConfiguration.setParameter

Sets the value of the configuration parameter param for the document document to value.

Errors:

— Function: sdom:can-set-dom-config-parameter? document param value
— Function: DOMConfiguration.canSetParameter

Returns #f if a call to sdom:set-dom-config-parameter! for document document and arguments param and value would lead to an exception being thrown, #t otherwise.


Next: , Previous: Properties and configuration, Up: SDOM API reference

7.5 Namespaces


Next: , Previous: Namespaces, Up: SDOM API reference

7.6 Functions on Documents

— Function: sdom:normalize-document! document
— Function: Document.normalizeDocument

Puts document into “normal” form, potentially destructively modifying the structure of document, depending on which DOM configuration parameters are in place for this document

Errors:

— Function: sdom:get-element-by-id document value
— Function: Document.getElementById

Returns the first element found in a document order traversal of the document document that has an attribute identified as an id attribute whose value is value.

Errors:

— Function: sdom:get-elements-by-tag-name document name [namespace]
— Function: Document.getElementsByTagName

Returns a list of element nodes in the document given by document for which the DOM property “sdom:tag-name” is equal to the string name. If namespace is given, the nodes must also belong to a namespace whose URI is equal to namespace.

Errors:


Next: , Previous: Functions on Documents, Up: SDOM API reference

7.7 Functions on Elements

— Function: sdom:get-attribute-node element name [namespace]
— Function: Element.getAttributeNode

Returns the attr node attached to element whose is name is name and whose namespace is namespace, if specified. If no such attr node exists, returns null.

Errors:

— Function: sdom:set-attribute-node! element attr
— Function: Element.setAttributeNode

Attaches the attr node attr as a new attribute of element element. Errors:

— Function: sdom:remove-attribute-node! element attr
— Function: Element.removeAttributeNode

Removes the attr node attr from its owner element, element.

Errors:

— Function: sdom:get-attribute element name [namespace]
— Function: Element.getAttribute

Returns the value of the attribute attached to element whose is name is name and whose namespace is namespace, if specified. If no such attribute exists, returns null.

Errors:

— Function: sdom:set-attribute! element name value [namespace]
— Function: Element.setAttribute

Sets value as the value for the attribute attached to element element whose name is name and whose namespace is namespace, if specified.

Errors:

— Function: sdom:remove-attribute! element name [namespace]
— Function: Element.removeAttribute

Removes the attribute from element element whose name is name and whose namespace is namespace, if specified.

Errors:

— Function: sdom:set-id-attribute! element name is-id [namespace]
— Function: Element.setIdAttribute

Attaches an annotation to the attribute attached to element element whose name is name and whose namespace is namespace, if specified, that indicates, based on the boolean value is-id, whether or not the attribute should be used as an id attribute.

Errors:

— Function: sdom:set-id-attribute-node! element attr is-id
— Function: Element.setIdAttributeNode

Attaches an annotation to the attr node attr attached to element element that indicates, based on the boolean value is-id, whether or not the attribute should be used as an id attribute.

Errors:


Next: , Previous: Functions on Elements, Up: SDOM API reference

7.8 Functions on Text nodes

— Function: sdom:replace-whole-text! node text
— Function: Text.replaceWholeText

Replaces the text content of node and all adjacent text nodes (according to document order) with the string text. If adjacent text nodes exist, they will be removed.

Errors:


Previous: Functions on Text nodes, Up: SDOM API reference

7.9 User data

The SDOM user data API allows programmers to attach arbitrary data to particular nodes using a hashtable-like mechanism, and to register handler procedures that will be called when the node is affected by a particular node manipulation function.

Like DOM configuration parameters, SDOM does not consider user data to be a persistent part of an XML document; as such, user data and handlers are stored in a hashtable separate from the document itself and will not be available outside the current process space.

— Function: sdom:get-user-data node key
— Function: Node.getUserData

Retrieves the user data stored for node under the key string key, or null if none exists.

— Function: sdom:set-user-data! node key value handler
— Function: Node.setUserData

Stores the value value and a handler procedure handler under the key string key for node node. The handler should have the following signature:

          (lambda (op key value src dst) ...)

It will be called such that op is one of the user data event types defined in the enumeration here; key is the key string that was used in the original call that installed the handler; value is the value used in the call; src and dst are references to, respectively, the source and destination nodes involved in the event. For some events, dst may be null.

If no handler is desired, pass null in place of a procedure.


Next: , Previous: SDOM API reference, Up: Top

8 SDOM property reference


Up: SDOM property reference

8.1 Properties for Nodes

The following properties apply to all node types, since, under the DOM recommendation they all share the same root interface.

— sdom:node-type:
— Node.nodeType:

Returns the type of node. See Node types.

— sdom:node-name:
— Node.nodeName:

The name of node. This value depends on the type of node. If node has type sdom:node-type-element or sdom:node-type-attr this value will be a symbol; otherwise it will be a string or null. See http://www.w3c.org/TR/2004/REC-DOM-Level-3-Core-20040407/ for more information.

— sdom:node-value:
— sdom:set-node-value!:
— Node.nodeValue:

The value of node. This value depends on the type of node. If the DOM recommendation defines this value to be null, setting it will have no effect.

Errors on setting:

— sdom:parent-node:
— Node.parentNode:

Property type: Node

The parent of node, if it is defined to have one and is a member of a document tree; #f otherwise

— sdom:child-nodes:
— Node.childNodes:

Property type: List of nodes

A list of the child nodes of node, if it has any; null if there are no children or if node is not defined to have any

— sdom:first-child:
— Node.firstChild:

Property type: Node

The first item in the list of children of node, if there are any children, #f otherwise. The value of this property is equivalent to the car of the value of sdom:child-nodes

— sdom:last-child:
— Node.lastChild:

Property type: Node

The last item in the list of children of node, if there are any children, #f otherwise. The value of this property is equivalent to the car of the last pair of the value of sdom:child-nodes

— sdom:previous-sibling:
— Node.previousSibling:

Property type: Node

The item that precedes node in the parent's list of child nodes, or #f if there is no parent node or node is the first child of the parent

— sdom:next-sibling:
— Node.nextSibling:

Property type: Node

The item that follows node in the parent's list of child nodes, or #f if there is no parent node or node is the last child of the parent

— sdom:attributes:
— Node.attributes:

Property type: List of nodes

A list of the attributes attached to node; null if node is not of type sdom:node-type-element or it has no attributes

— sdom:owner-document:
— Node.ownerDocument:

Property type: Node

The document node representing the document to which node belongs, or #f if the document cannot be determined or if node is itself of type sdom:node-type-document

— sdom:namespace-uri:
— Node.namespaceURI:

Property type: String

The namespace URI attached to node at the time of its creation or #f if none was specified.

— sdom:prefix:
— sdom:set-prefix!:
— Node.prefix:

The namespace prefix for node, or #f if it is unspecified. This property can only be set for element and attr nodes; setting it on any other type of node will have no effect.

Errors on setting:

— sdom:local-name:
— Node.localName:

Property type: String

The local part of the qualified name for node, or #f if node is not an element or attr node.

— sdom:base-uri:
— Node.baseURI:

Property type: String

The base URI of node, as determined by the algorithms described in the W3C Recommendation, or #f if a value could not be determined.

— sdom:text-content:
— sdom:set-text-content!:
— Node.textContent:

Errors on setting:


Next: , Up: Properties for Nodes

8.1.1 Properties for Character Data nodes

— sdom:data:
— sdom:set-data!:
— CharacterData.data:

Property type: String

The content of node, represented as a string of UTF-16 characters

Errors on setting:

— sdom:length:
— CharacterData.length:

Property type: Number

The length of the value of the sdom:data property of node in UTF-16 characters


Up: Properties for Character Data nodes
8.1.1.1 Properties for Text nodes

— sdom:is-element-content-whitespace:
— Text.isElementContentWhitespace:

Property type: Boolean

#t if the content of node represents the whitespace between elements introduced by user formatting, as determined during normalization of the document to which node belongs1; #f otherwise

— sdom:whole-text:
— Text.wholeText:

Property type: String

A concatenation of all nodes of type sdom:node-type-text or sdom:node-type-cdata-section, adjacent to node in a document order traversal that does not cross any nodes of type sdom:node-type-element, sdom:node-type-comment or sdom:node-type-processing-instruction


Next: , Previous: Properties for Character Data nodes, Up: Properties for Nodes

8.1.2 Properties for Notation nodes

— sdom:public-id:
— Notation.publicId:

Property type: String

The public identifier for node or #f if none was specified

— sdom:system-id:
— Notation.systemId:

Property type: String

The system identifier for node or #f if none was specified


Next: , Previous: Properties for Notation nodes, Up: Properties for Nodes

8.1.3 Properties for Entities

— sdom:public-id:
— Entity.publicId:

Property type: String

The public identifier for node or #f if none was specified

— sdom:system-id:
— Entity.systemId:

Property type: String

The system identifier for node or #f if none was specified

— sdom:notation-name:
— Entity.notationName:

Property type: String

The name of the notation for node if node is an unparsed entity, #f otherwise

— sdom:input-encoding:
— Entity.inputEncoding:

Property type: String

The name of the encoding for node at parse time, if node is an external parsed entity; #f otherwise

— sdom:xml-encoding:
— Entity.xmlEncoding:

Property type: String

The name of the encoding for node, if node is an external parsed entity; #f otherwise

— sdom:xml-version:
— Entity.xmlVersion:

Property type: String

The version number for node, if node is an external parsed entity; #f otherwise


Next: , Previous: Properties for Entities, Up: Properties for Nodes

8.1.4 Properties for Processing Instruction nods

— sdom:target:
— ProcessingInstruction.target:

Property type: String

The target of node

— sdom:data:
— sdom:set-data!:
— ProcessingInstruction.data:

Property type: String

The content of node

Errors on setting:


Next: , Previous: Properties for Processing Instruction nodes, Up: Properties for Nodes

8.1.5 Properties for Attr nodes

— sdom:name:
— Attr.name:

Property type: String

The name of node. This will be a qualified name if sdom:local-name is not #f

— sdom:specified:
— Attr.specified:

Property type: Boolean

Whether or not node has been given a value. Under SDOM, this equates to whether or not node has any children that have type sdom:node-type-text

— sdom:value:
— sdom:set-value!:
— Attr.value:

Property type: String

The value of node. Setting this value creates a new text node that is inserted as a child of node

Errors on setting:

— sdom:owner-element:
— Attr.ownerElement:

Property type: Node

The element to which node is attached or #f if node is not in use

— sdom:schema-type-info:
— Attr.schemaTypeInfo:

Property type: N/A

SDOM does not currently support XML Schema; this property will always have the value #f

— sdom:is-id:
— Attr.isId:

Property type: Boolean

SDOM does not currently support XML Schema or DTD validation; this property will always have the value #f


Next: , Previous: Properties for Attr nodes, Up: Properties for Nodes

8.1.6 Properties for Elements

— sdom:tag-name:
— Element.tagName:

Property type: String

The name of node. This will be a qualified name if sdom:local-name is not #f

— sdom:schema-type-info:
— Element.schemaTypeInfo:

Property type: N/A

SDOM does not currently support XML Schema; this property will always have the value #f


Next: , Previous: Properties for Elements, Up: Properties for Nodes

8.1.7 Properties for Document Type nodes

— sdom:name:
— DocumentType.name:

Property type: String

The name of the DTD represented by node

— sdom:entities:
— DocumentType.entities:

Property type: List of nodes

A list of nodes representing internal and external entities declared by node, not including duplicates or parameter entities

— sdom:notations:
— DocumentType.notations:

Property type: List of nodes

A list of nodes representing notations declared by node, not including duplicates

— sdom:public-id:
— DocumentType.publicId:

Property type: String

The public identifier of node

— sdom:system-id:
— DocumentType.systemId:

Property type: String

The system identifier of node

— sdom:internal-subset:
— DocumentType.internalSubset:

Property type: String

The internal subset represented by node or #f if there is none


Previous: Properties for Document Type nodes, Up: Properties for Nodes

8.1.8 Properties for Document nodes

— sdom:doc-type:
— Document.doctype:

Property type: Node

The node giving the Document Type Definition attached to node, or #f if none exists

— sdom:implementation:
— Document.implementation:

Property type: N/A

SDOM does not currently support the DOMImplementation interface; this property will always have the value #f

— sdom:document-element:
— Document.documentElement:

Property type: Node

The first (and only) child of node that has type sdom:node-type-element, or #f if no such child exists

— sdom:input-encoding:
— Document.inputEncoding:

Property type: String

The encoding type used at the time of parsing, or #f if unknown; this property will always have the value #f under SDOM

— sdom:xml-encoding:
— Document.xmlEncoding:

Property type: String

The encoding type of the document to which node belongs, or #f if unknown; this property will always have the value #f under SDOM

— sdom:xml-standalone:
— sdom:set-xml-standalone!:
— Document.xmlStandalone:

Property type: Boolean

Whether the document to which node belongs is standalone, or #f if unknown; this property will always have the initial value #f under SDOM

Errors on setting:

— sdom:xml-version:
— sdom:set-xml-version!:
— Document.xmlVersion:

Property type: String

The version number of this document; this property will always have the initial value #f under SDOM

Errors on setting:

— sdom:strict-error-checking:
— sdom:set-strict-error-checking!:
— Document.strictErrorChecking:

Property type: Boolean

Whether or not to perform strict error checking during document normalization.

— sdom:document-uri:
— Document.documentURI:

Property type: String

The location of node or #f if undefined

— sdom:dom-config:
— Document.domConfig:

Property type: N/A

SDOM does not currently support the DOMConfiguration interface; use sdom:set-dom-config-parameter! and sdom:get-dom-config-parameter to interact with the DOM configuration


Next: , Previous: SDOM property reference, Up: Top

Appendix A GNU Free Documentation License

Version 1.2, November 2002
     Copyright © 2000,2001,2002 Free Software Foundation, Inc.
     59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
     
     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.
  1. PREAMBLE

    The purpose of this License is to make a manual, textbook, or other functional and useful document free in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others.

    This License is a kind of “copyleft”, which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software.

    We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference.

  2. APPLICABILITY AND DEFINITIONS

    This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The “Document”, below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as “you”. You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law.

    A “Modified Version” of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language.

    A “Secondary Section” is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them.

    The “Invariant Sections” are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.

    The “Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words.

    A “Transparent” copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not “Transparent” is called “Opaque”.

    Examples of suitable formats for Transparent copies include plain ascii without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.

    The “Title Page” means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, “Title Page” means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text.

    A section “Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) To “Preserve the Title” of such a section when you modify the Document means that it remains a section “Entitled XYZ” according to this definition.

    The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License.

  3. VERBATIM COPYING

    You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3.

    You may also lend copies, under the same conditions stated above, and you may publicly display copies.

  4. COPYING IN QUANTITY

    If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.

    If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.

    If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public.

    It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document.

  5. MODIFICATIONS

    You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:

    1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission.
    2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement.
    3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
    4. Preserve all the copyright notices of the Document.
    5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
    6. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below.
    7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice.
    8. Include an unaltered copy of this License.
    9. Preserve the section Entitled “History”, Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled “History” in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
    10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the “History” section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission.
    11. For any section Entitled “Acknowledgements” or “Dedications”, Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein.
    12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles.
    13. Delete any section Entitled “Endorsements”. Such a section may not be included in the Modified Version.
    14. Do not retitle any existing section to be Entitled “Endorsements” or to conflict in title with any Invariant Section.
    15. Preserve any Warranty Disclaimers.

    If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles.

    You may add a section Entitled “Endorsements”, provided it contains nothing but endorsements of your Modified Version by various parties—for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard.

    You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one.

    The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version.

  6. COMBINING DOCUMENTS

    You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers.

    The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work.

    In the combination, you must combine any sections Entitled “History” in the various original documents, forming one section Entitled “History”; likewise combine any sections Entitled “Acknowledgements”, and any sections Entitled “Dedications”. You must delete all sections Entitled “Endorsements.”

  7. COLLECTIONS OF DOCUMENTS

    You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects.

    You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document.

  8. AGGREGATION WITH INDEPENDENT WORKS

    A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an “aggregate” if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document.

    If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.

  9. TRANSLATION

    Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail.

    If a section in the Document is Entitled “Acknowledgements”, “Dedications”, or “History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.

  10. TERMINATION

    You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.

  11. FUTURE REVISIONS OF THIS LICENSE

    The Free Software Foundation may publish new, revised versions of the GNU Free Documentation License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. See http://www.gnu.org/copyleft/.

    Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License “or any later version” applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation.

A.0.1 ADDENDUM: How to use this License for your documents

To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page:

       Copyright (C)  year  your name.
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.2
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
       Texts.  A copy of the license is included in the section entitled ``GNU
       Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this:

         with the Invariant Sections being list their titles, with
         the Front-Cover Texts being list, and with the Back-Cover Texts
         being list.

If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation.

If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software.


Next: , Previous: GNU Free Documentation License, Up: Top

Procedure index


Previous: Procedure index, Up: Top

Variable index


Footnotes

[1] The DOM recommendation specifies that this determination can also be made at load time, but since SDOM relies on SSAX for parsing documents, this information is not reliably available.