Copyright ©2001 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.
This specification defines the Document Object Model Abstract Schemas and Load and Save Level 3, a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure and style of documents. The Document Object Model Abstract Schemas and Load and Save Level 3 builds on the Document Object Model Core Level 3 [DOM Level 3 Core].
This section describes the status of this document at the time of its publication. Other documents may supersede this document. The latest status of this document series is maintained at the W3C.
This is a W3C Working Draft for review by W3C members and other interested parties.
It is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". This is work in progress and does not imply endorsement by, or the consensus of, either W3C or members of the DOM working group.
Comments on this document are invited and are to be sent to the public mailing list www-dom@w3.org. An archive is available at http://lists.w3.org/Archives/Public/www-dom/.
This document has been produced as part of the W3C DOM Activity. The authors of this document are the DOM WG members.
A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR.
Copyright © 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
This document is published under the W3C Document Copyright Notice and License. The bindings within this document are published under the W3C Software Copyright Notice and License. The software license requires "Notice of any changes or modifications to the W3C files, including the date changes were made." Consequently, modified versions of the DOM bindings must document that they do not conform to the W3C standard; in the case of the IDL definitions, the pragma prefix can no longer be 'w3c.org'; in the case of the Java language binding, the package names can no longer be in the 'org.w3c' package.
Note: This section is a copy of the W3C Document Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-documents-19990405.
Copyright © 1994-2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/
Public documents on the W3C site are provided by the copyright holders under the following license. The software or Document Type Definitions (DTDs) associated with W3C specifications are governed by the Software Notice. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
Permission to use, copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use:
When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof.
No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements.
THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders.
Note: This section is a copy of the W3C Software Copyright Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720
Copyright © 1994-2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved.
http://www.w3.org/Consortium/Legal/
This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
Permission to use, copy, and modify this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
This chapter describes the optional DOM Level 3 Abstract Schemas
(AS) module. This module provides a representation for XML
abstract schemas, e.g., DTDs [XML] and XML Schemas [XML Schema
Part 0], together with operations on the abstract schemas, and
how such information within the abstract schemas could be applied
to XML documents used
in both the document-editing and AS-editing worlds. A DOM
application can use the hasFeature
method of the
DOMImplementation
interface defined in DOM Core to
determine whether a given DOM supports these capabilities or not.
One feature string for the AS-editing interfaces listed in this
section is "AS-EDIT
" and another feature string for
document-editing interfaces is "AS-DOC
".
This chapter interacts strongly with Document Object Model Load and Save. Not only will that code serialize/deserialize abstract schemas, but it may also wind up defining its well-formedness and validity checks in terms of what is defined in this chapter. In addition, the AS and Load/Save functional areas uses the error-reporting mechanism allowing user-registered error callbacks introduced in [DOM Level 3 Core]. Note that this may not imply that the parser actually calls the DOM's validation code -- it may be able to achieve better performance via its own -- but the appearance to the user should probably be "as if" the DOM has been asked to validate the document, and parsers should probably be able to validate newly loaded documents in terms of a previously loaded DOM AS.
Finally, this chapter will have separate sections to address the needs of the document-editing and AS-editing worlds, along with a section that details overlapping areas such as validation. In this manner, the document-editing world's focuses on editing aspects and usage of information in the AS are made distinct from the AS-editing world's focuses on defining and manipulating the information in the AS.
In the October 9, 1997 DOM requirements document, the following appeared: "There will be a way to determine the presence of a DTD. There will be a way to add, remove, and change declarations in the underlying DTD (if available). There will be a way to test conformance of all or part of the given document against a DTD (if available)." In later discussions, the following was added, "There will be a way to query element/attribute (and maybe other) declarations in the underlying DTD (if available)," supplementing the primitive support for these in Level 1.
That work was deferred past Level 2, in the hope that XML Schemas would be addressed as well. It is anticipated that lowest common denominator general APIs generated in this chapter can support both DTDs and XML Schemas, and other XML abstract schemas down the road.
The kinds of information that an Abstract Schema must make available are mostly self-evident from the definitions of Infoset, DTDs, and XML Schemas. Note that some kinds of information on which the DOM already relies, e.g., default values for attributes, will finally be given a visible representation here.
The abstract schema referenced in these use cases/requirements is an abstraction and does not refer solely to DTDs or XML Schemas.
For the AS-editing and document-editing worlds, the following use cases and requirements are common to both and could be labeled as the "Validation and Other Common Functionality" section:
Use Cases:
Requirements:
Specific to the AS-editing world, the following are use cases and requirements and could be labeled as the "AS-editing" section:
Use Cases:
Requirements:
Specific to the document-editing world, the following are use cases and requirements and could be labeled as the "Document-editing" section:
Use Cases:
Requirements:
General Issues:
QName
, e.g.,
foo:bar
, whereas the latter will report its namespace
and local name, e.g., {http://my.namespace}bar
. We
have added the isNamespaceAware
attribute to the
generic AS object to help applications determine which of these
fields are important, but we are still analyzing this
challenge.NodeEditAS.can*()
,
CharacterDataEditAS.can*()
, and
ElementEditAS.can*()
methods throw exceptions like the
isNodeValid()
method. Resolution: no exceptions should
be thrown; it should be allowed if it's not forbidden. Better
descriptions are in order for the true/false returns.ASModel
is activated, will there be cleanup done to remove the previous
ASModel's default attributes and entity definitions, if any? AS ET
members felt that whatever is done implementation-wise, correct
behavior should result.ASModel
container of other ASModels.A list of the proposed Abstract Schema data structures and
functions follow, starting off with the data structures and
"AS-editing" methods. Note that operations on the ASModel
that could result in its being invalid will be discovered during
document validation and not during the AS editing operation, for
example, removeNode(). Finally, note that an example element
declaration: for (A, (B* | C), D+)
can be described by
the following:
ASElementDeclaration example = { strictMixedContent = false; elementType = STRING_DATATYPE; isPCDataOnly = false; contentType = ELEMENTS_CONTENTTYPE; tagname = "example"; ASContentModel = exE; ASAttributeDecls = null; } ASContentModel exE = { listOperator = AS_SEQUENCE; minOccurs = 1; maxOccurs = 1; subModels = {(ASElementDeclaration A), (ASContentModel exBC), (ASContentModel exD)}; } ASElementDeclaration A = { strictMixedContent = false; elementType = STRING_DATATYPE; isPCDataOnly = false; contentType = ELEMENTS_CONTENTTYPE; tagname = "A"; ASContentModel = null; ASAttributeDecls = null; } ASContentModel exBC = { listOperator = AS_CHOICE; minOccurs = 1; maxOccurs = 1; subModels = {(ASContentModel exB), (ASElementDeclaration C)}; } ASContentModel exB = { listOperator = AS_NONE; minOccurs = 0; maxOccurs = AS_UNBOUNDED; subModels = {(ASElementDeclaration B)}; } ASElementDeclaration B = { strictMixedContent = false; elementType = STRING_DATATYPE; isPCDataOnly = false; contentType = ELEMENTS_CONTENTTYPE; tagname = "B"; ASContentModel = null; ASAttributeDecls = null; } ASElementDeclaration C = { strictMixedContent = false; elementType = STRING_DATATYPE; isPCDataOnly = false; contentType = ELEMENTS_CONTENTTYPE; tagname = "C"; ASContentModel = null; ASAttributeDecls = null; } ASContentModel exD = { listOperator = AS_NONE; minOccurs = 1; maxOccurs = AS_UNBOUNDED; subModels = {(ASElementDeclaration D)}; } ASElementDeclaration D = { strictMixedContent = false; elementType = STRING_DATATYPE; isPCDataOnly = false; contentType = ELEMENTS_CONTENTTYPE; tagname = "D"; ASContentModel = null; ASAttributeDecls = null; }
Abstract Schemas operations may throw a
DOMSystemException
as described in their
descriptions.
exception DOMASException { unsigned short code; }; // ASExceptionCode const unsigned short DUPLICATE_NAME_ERR = 1; const unsigned short TYPE_ERR = 2; const unsigned short NO_AS_AVAILABLE = 3; const unsigned short WRONG_MIME_TYPE_ERR = 4;
An integer indicating the type of error generated.
DUPLICATE_NAME_ERR
AS_CHOICE
operator.NO_AS_AVAILABLE
DocumentEditAS
related to the node does not have any active ASModel
and wfValidityCheckLevel
is set to
PARTIAL
or STRICT_VALIDITY_CHECK
.TYPE_ERR
ASObject
is neither an
ASContentModel
nor an ASElementDeclaration
.WRONG_MIME_TYPE_ERR
mimeTypeCheck
is true
and the
input source has an incorrect MIME Type. See the attribute
mimeTypeCheck
.To begin with, an abstract schema is a generic structure that
could contain both internal and external subsets. An
ASModel
is an abstract object that could map to a DTD
[XML],
an XML Schema [XML Schema Part 0], a database
schema, etc. An ASModel
could represent either an
internal or an external subset; hence an abstract schema could be
composed of an ASModel
representing the internal
subset and an ASModel
representing the external
subset. Note that the ASModel
representing the
external subset could consult the ASModel
representing
the internal subset. Furthermore, the ASModel
representing the internal subset could be set to null by the
setInternalAS
method as a mechanism for "removal". In
addition, only one ASModel
representing the external
subset can be specified as "active" and it is possible that none
are "active". Finally, the ASModel
contains the
factory methods needed to create a various types of ASObjects like
ASElementDeclaration
,
ASAttributeDeclaration
, etc.
interface ASModel : ASObject { readonly attribute boolean isNamespaceAware; readonly attribute unsigned short usageLocation; attribute DOMString asLocation; attribute DOMString asHint; readonly attribute ASNamedObjectMap elementDeclarations; readonly attribute ASNamedObjectMap attributeDeclarations; readonly attribute ASNamedObjectMap notationDeclarations; readonly attribute ASNamedObjectMap entityDeclarations; readonly attribute ASNamedObjectMap contentModelDeclarations; void setASModel(in ASModel abstractSchema); ASObjectList getASModels(); void removeAS(in ASModel as); boolean validate(); ASElementDeclaration createASElementDeclaration(in DOMString namespaceURI, in DOMString name) raises(DOMException); ASAttributeDeclaration createASAttributeDeclaration(in DOMString namespaceURI, in DOMString name) raises(DOMException); ASNotationDeclaration createASNotationDeclaration(in DOMString namespaceURI, in DOMString name, in DOMString systemId, in DOMString publicId) raises(DOMException); ASEntityDeclaration createASEntityDeclaration(in DOMString name) raises(DOMException); ASContentModel createASContentModel(in unsigned long minOccurs, in unsigned long maxOccurs, in unsigned short operator) raises(DOMASException); };
asHint
of type
DOMString
asLocation
of type
DOMString
attributeDeclarations
of type ASNamedObjectMap
,
readonlyASObject
with ASModel
methods, have discernible
top-level/"global" attribute declarations. If one attempts to add,
set, or remove a node type other than the intended one, a hierarchy
exception (or equivalent is thrown).contentModelDeclarations
of type ASNamedObjectMap
,
readonlyASObject
with ASModel
methods, have discernible
top-level/"global content model declarations. If one attempts to
add, set, or remove a node type other than the intended one, a
hierarchy exception (or equivalent is thrown).elementDeclarations
of type ASNamedObjectMap
,
readonlyASObject
with ASModel
methods, have discernible
top-level/"global" element declarations. If one attempts to add,
set, or remove a node type other than the intended one, a hierarchy
exception (or equivalent is thrown).entityDeclarations
of type ASNamedObjectMap
,
readonlyASObject
with ASModel
methods, have discernible
top-level/"global" entity declarations. If one attempts to add,
set, or remove a node type other than the intended one, a hierarchy
exception (or equivalent is thrown).isNamespaceAware
of type boolean
, readonlytrue
if this ASModel
defines the
document structure in terms of namespaces and local names [XML
Namespaces]; false
if the document structure is
defined only in terms of QNames
.notationDeclarations
of type ASNamedObjectMap
,
readonlyASObject
with ASModel
methods, have discernible
top-level/"global" notation declarations. If one attempts to add,
set, or remove a node type other than the intended one, a hierarchy
exception (or equivalent is thrown).usageLocation
of
type unsigned short
, readonlycreateASAttributeDeclaration
namespaceURI
of type
DOMString
name
of type
DOMString
A new
|
|
INVALID_CHARACTER_ERR: Raised if the input |
createASContentModel
ASElementDeclaration
's
content model.
minOccurs
of type
unsigned long
ASContentModel
.maxOccurs
of type
unsigned long
ASContentModel
.operator
of type
unsigned short
AS_CHOICE
,
AS_SEQUENCE
, AS_ALL
or
AS_NONE
.
A new |
A DOMASException, e.g., |
createASElementDeclaration
namespaceURI
of type
DOMString
namespace URI
of the element type being
declared.name
of type
DOMString
A new |
|
INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character. |
createASEntityDeclaration
name
of type
DOMString
A new
|
|
INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character. |
createASNotationDeclaration
namespaceURI
of type
DOMString
name
of type
DOMString
systemId
of type
DOMString
publicId
of type
DOMString
A new |
|
INVALID_CHARACTER_ERR: Raised if the specified name contains an illegal character. |
getASModels
A list of ASModels. |
removeAS
ASModel
from the list of ASModel
s.
as
of type ASModel
setASModel
abstractSchema
of type ASModel
ownerASModel
.validate
ASModel
itself is
valid, i.e., confirming that it's well-formed and valid per its own
formal grammar.
|
|
The ASObject
interface is analogous to a
Node
in [DOM Level 3 Core], e.g., an element
declaration.
Opaque.
interface ASObject { // ASObjectType const unsigned short AS_ELEMENT_DECLARATION = 1; const unsigned short AS_ATTRIBUTE_DECLARATION = 2; const unsigned short AS_NOTATION_DECLARATION = 3; const unsigned short AS_ENTITY_DECLARATION = 4; const unsigned short AS_CONTENTMODEL = 5; const unsigned short AS_MODEL = 6; readonly attribute unsigned short asNodeType; attribute ASModel ownerASModel; attribute DOMString nodeName; attribute DOMString prefix; attribute DOMString localName; attribute DOMString namespaceURI; ASObject cloneASObject(in boolean deep); };
An integer indicating which type of ASObject
this
is.
AS_ATTRIBUTE_DECLARATION
ASAttributeDeclaration
.AS_CONTENTMODEL
ASContentModel
.AS_ELEMENT_DECLARATION
ASElementDeclaration
.AS_ENTITY_DECLARATION
ASEntityDeclaration
.AS_MODEL
ASModel
.AS_NOTATION_DECLARATION
ASNotationDeclaration
.asNodeType
of type unsigned
short
, readonlylocalName
of type
DOMString
ASObject
.namespaceURI
of type
DOMString
null
if it is
unspecified. [XML Schema Part 1] defines how a
namespace URI
is attached to schema components.nodeName
of type
DOMString
name
of this ASObject
depending
on the ASObject
type.ownerASModel
of type ASModel
ASModel
object associated with this ASObject
. For a node of
type AS_MODEL
, this is null
.prefix
of type
DOMString
null
if it is
unspecified.cloneASObject
ASObject
.
See text for cloneNode
off of Node
but
substitute AS functionality.
deep
of type
boolean
deep
flag on, causes the whole subtree
to be duplicated. Setting it to false
only duplicates
its immediate child nodes.
Cloned |
The ASObjectList
interface provides the abstraction
of an ordered collection of AS nodes, without defining or
constraining how this collection is implemented.
ASObjectList
objects in the DOM AS are live.
interface ASObjectList { readonly attribute unsigned long length; ASObject item(in unsigned long index); };
item
index
th item in the
collection. The index starts at 0. If index
is greater
than or equal to the number of nodes in the list, this returns
null
.
index
of type
unsigned long
Objects implementing the ASNamedObjectMap
interface
are used to represent collections of abstract schema nodes that can
be accessed by name. Note that ASNamedObjectMap
does
not inherit from ASObjectList
;
ASNamedObjectMaps
are not maintained in any particular
order. Objects contained in an object implementing
ASNamedObjectMap
may also be accessed by an ordinal
index, but this is simply to allow convenient enumeration of the
contents of a ASNamedObjectMap
, and does not imply
that the DOM specifies an order to these ASObjects
.
ASNamedObjectMap
object in the DOM are live.
interface ASNamedObjectMap { readonly attribute unsigned long length; ASObject getNamedItem(in DOMString name); ASObject getNamedItemNS(in DOMString namespaceURI, in DOMString localName); ASObject item(in unsigned long index); ASObject removeNamedItem(in DOMString name) raises(DOMException); ASObject removeNamedItemNS(in DOMString namespaceURI, in DOMString localName) raises(DOMException); ASObject setNamedItem(in ASObject newASObject) raises(DOMException); ASObject setNamedItemNS(in ASObject newASObject) raises(DOMException); };
length
of type
unsigned long
, readonlyASObjects
in the ASObjectList
.
The range of valid child node indices is 0 to
length-1
inclusive.getNamedItem
getNamedItemNS
ASObject
specified by local
name and namespace URI.
namespaceURI
of type
DOMString
ASObject
to retrieve.localName
of type
DOMString
ASObject
to retrieve.item
index
th item in the
map. The index starts at 0
. If index
is
greater than or equal to the number of nodes in the list, this
returns null
.
index
of type
unsigned long
removeNamedItem
removeNamedItemNS
ASObject
specified by a namespace URI and a local name.
namespaceURI
of type
DOMString
ASObject
to be removed.localName
of type
DOMString
ASObject
to remove.
|
NOT_FOUND_ERR: Raised if there is no node with the specified
NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. |
setNamedItem
ASObject
using its nodeName
attribute. If an ASObject
with that name is already present in this map, it is replaced by
the new one.
If the new node replaces an existing one, the replaced node is
returned, otherwise |
|
WRONG_DOCUMENT_ERR: Raised if NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly. HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a
node doesn't belong in this |
setNamedItemNS
ASObject
using its namespaceURI
and localName
. If
an ASObject
with the same namespaceURI
and localName
is already present in this map, it is replaced by the new one.
If the new node replaces an existing one, the replaced node is
returned, otherwise |
|
|
The datatypes supported by DOM AS implementations. Further datatypes may be added in the Schema/PSVI spec.
interface ASDataType { readonly attribute unsigned short dataType; // DATA_TYPES const unsigned short STRING_DATATYPE = 1; const unsigned short NOTATION_DATATYPE = 10; const unsigned short ID_DATATYPE = 11; const unsigned short IDREF_DATATYPE = 12; const unsigned short IDREFS_DATATYPE = 13; const unsigned short ENTITY_DATATYPE = 14; const unsigned short ENTITIES_DATATYPE = 15; const unsigned short NMTOKEN_DATATYPE = 16; const unsigned short NMTOKENS_DATATYPE = 17; const unsigned short BOOLEAN_DATATYPE = 100; const unsigned short FLOAT_DATATYPE = 101; const unsigned short DOUBLE_DATATYPE = 102; const unsigned short DECIMAL_DATATYPE = 103; const unsigned short HEXBINARY_DATATYPE = 104; const unsigned short BASE64BINARY_DATATYPE = 105; const unsigned short ANYURI_DATATYPE = 106; const unsigned short QNAME_DATATYPE = 107; const unsigned short DURATION_DATATYPE = 108; const unsigned short DATETIME_DATATYPE = 109; const unsigned short DATE_DATATYPE = 110; const unsigned short TIME_DATATYPE = 111; const unsigned short GYEARMONTH_DATATYPE = 112; const unsigned short GYEAR_DATATYPE = 113; const unsigned short GMONTHDAY_DATATYPE = 114; const unsigned short GDAY_DATATYPE = 115; const unsigned short GMONTH_DATATYPE = 116; const unsigned short INTEGER = 117; const unsigned short NAME_DATATYPE = 200; const unsigned short NCNAME_DATATYPE = 201; const unsigned short NORMALIZEDSTRING_DATATYPE = 202; const unsigned short TOKEN_DATATYPE = 203; const unsigned short LANGUAGE_DATATYPE = 204; const unsigned short NONPOSITIVEINTEGER_DATATYPE = 205; const unsigned short NEGATIVEINTEGER_DATATYPE = 206; const unsigned short LONG_DATATYPE = 207; const unsigned short INT_DATATYPE = 208; const unsigned short SHORT_DATATYPE = 209; const unsigned short BYTE_DATATYPE = 210; const unsigned short NONNEGATIVEINTEGER_DATATYPE = 211; const unsigned short UNSIGNEDLONG_DATATYPE = 212; const unsigned short UNSIGNEDINT_DATATYPE = 213; const unsigned short UNSIGNEDSHORT_DATATYPE = 214; const unsigned short UNSIGNEDBYTE_DATATYPE = 215; const unsigned short POSITIVEINTEGER_DATATYPE = 216; const unsigned short OTHER_SIMPLE_DATATYPE = 1000; const unsigned short COMPLEX_DATATYPE = 1001; };
An integer indicating which datatype this is.
ANYURI_DATATYPE
BASE64BINARY_DATATYPE
BOOLEAN_DATATYPE
BYTE_DATATYPE
COMPLEX_DATATYPE
DATETIME_DATATYPE
DATE_DATATYPE
DECIMAL_DATATYPE
DOUBLE_DATATYPE
DURATION_DATATYPE
ENTITIES_DATATYPE
ENTITY_DATATYPE
FLOAT_DATATYPE
GDAY_DATATYPE
GMONTHDAY_DATATYPE
GMONTH_DATATYPE
GYEARMONTH_DATATYPE
GYEAR_DATATYPE
HEXBINARY_DATATYPE
IDREFS_DATATYPE
IDREF_DATATYPE
ID_DATATYPE
INTEGER
INT_DATATYPE
LANGUAGE_DATATYPE
LONG_DATATYPE
NAME_DATATYPE
NCNAME_DATATYPE
NEGATIVEINTEGER_DATATYPE
NMTOKENS_DATATYPE
NMTOKEN_DATATYPE
NONNEGATIVEINTEGER_DATATYPE
NONPOSITIVEINTEGER_DATATYPE
NORMALIZEDSTRING_DATATYPE
NOTATION_DATATYPE
OTHER_SIMPLE_DATATYPE
POSITIVEINTEGER_DATATYPE
QNAME_DATATYPE
SHORT_DATATYPE
STRING_DATATYPE
TIME_DATATYPE
TOKEN_DATATYPE
UNSIGNEDBYTE_DATATYPE
UNSIGNEDINT_DATATYPE
UNSIGNEDLONG_DATATYPE
UNSIGNEDSHORT_DATATYPE
dataType
of type unsigned
short
, readonlyThe element name along with the content specification in the
context of an ASObject
.
interface ASElementDeclaration : ASObject { // CONTENT_MODEL_TYPES const unsigned short EMPTY_CONTENTTYPE = 1; const unsigned short ANY_CONTENTTYPE = 2; const unsigned short MIXED_CONTENTTYPE = 3; const unsigned short ELEMENTS_CONTENTTYPE = 4; attribute boolean strictMixedContent; attribute ASDataType elementType; attribute boolean isPCDataOnly; attribute unsigned short contentType; attribute DOMString systemId; attribute ASContentModel asCM; attribute ASNamedObjectMap ASAttributeDecls; void addASAttributeDecl(in ASAttributeDeclaration attributeDecl); ASAttributeDeclaration removeASAttributeDecl(in ASAttributeDeclaration attributeDecl); };
ANY_CONTENTTYPE
ELEMENTS_CONTENTTYPE
EMPTY_CONTENTTYPE
MIXED_CONTENTTYPE
isPCDataOnly
would also need to checked, in
addition to this, if an element's content model was simply text, as
an example.ASAttributeDecls
of type ASNamedObjectMap
ASNamedObjectMap
containing
ASAttributeDeclarations
for all the attributes
that can appear on this type of element.asCM
of type
ASContentModel
contentType
of type unsigned short
EMPTY_CONTENTTYPE
, ANY_CONTENTTYPE
,
MIXED_CONTENTTYPE
,
ELEMENTS_CONTENTTYPE
.elementType
of type
ASDataType
isPCDataOnly
of type boolean
true
if the element is of type PCDATA only. Relevant
only for mixed content type elements.strictMixedContent
of type boolean
systemId
of
type DOMString
null
otherwise.addASAttributeDecl
ASAttributeDeclaration
for the element being
declared.
attributeDecl
of type
ASAttributeDeclaration
removeASAttributeDecl
ASAttributeDeclaration
from the element being
declared.
attributeDecl
of type
ASAttributeDeclaration
|
The content model of a declared element.
interface ASContentModel : ASObject { const unsigned long AS_UNBOUNDED = MAX_VALUE; // ASContentModelType const unsigned short AS_SEQUENCE = 0; const unsigned short AS_CHOICE = 1; const unsigned short AS_ALL = 2; const unsigned short AS_NONE = 3; attribute unsigned short listOperator; attribute unsigned long minOccurs; attribute unsigned long maxOccurs; attribute ASObjectList subModels; void removesubModel(in ASObject oldNode); void insertsubModel(in ASObject newNode) raises(DOMASException); unsigned long appendsubModel(in ASObject newNode) raises(DOMASException); };
0xFFFFFFFF FFFFFFFF
.
An integer indicating which type of ASContentModel
this is.
AS_ALL
AS_CHOICE
|
' operator.AS_NONE
AS_SEQUENCE
,
' operator.listOperator
of type unsigned short
AS_CHOICE
, AS_SEQUENCE
,
AS_ALL
or AS_NONE
. The operator is
applied to all the components(ASObjects) in the
subModels
. For example, if the list operator is
AS_CHOICE
and the components in subModels are a, b and
c then the abstract schema for the element being declared is
(a|b|c)
.maxOccurs
of type unsigned long
0
, a positive integer, or AS_UNBOUNDED
to
indicate that no upper limit has been set.minOccurs
of type unsigned long
subModels
of type ASObjectList
ASObject
s
such as ASElementDeclaration
s and further
ASContentModel
s.appendsubModel
subModels
.
newNode
of type ASObject
|
the length of the |
|
insertsubModel
newNode
of type ASObject
|
removesubModel
An attribute declaration in the context of a ASObject
.
interface ASAttributeDeclaration : ASObject { // VALUE_TYPES const unsigned short VALUE_NONE = 0; const unsigned short VALUE_DEFAULT = 1; const unsigned short VALUE_FIXED = 2; attribute ASDataType dataType; attribute DOMString dataValue; attribute DOMString enumAttr; attribute ASObjectList ownerElements; attribute unsigned short defaultType; };
VALUE_DEFAULT
VALUE_FIXED
VALUE_NONE
dataType
of type
ASDataType
dataValue
of type
DOMString
defaultType
of type
unsigned short
enumAttr
of type
DOMString
ownerElements
of
type ASObjectList
ASObject
of attribute, meaning that an attribute declaration can be shared
by multiple elements.Models a general entity declaration in an abstract schema.
interface ASEntityDeclaration : ASObject { // EntityType const unsigned short INTERNAL_ENTITY = 1; const unsigned short EXTERNAL_ENTITY = 2; attribute unsigned short entityType; attribute DOMString entityValue; attribute DOMString systemId; attribute DOMString publicId; };
An integer indicating which type of entity this is.
EXTERNAL_ENTITY
INTERNAL_ENTITY
entityType
of type unsigned short
entityValue
of type DOMString
EXTERNAL_ENTITY
, this is
null
.publicId
of type DOMString
null
otherwise.systemId
of type DOMString
null
otherwise.This interface represents a notation declaration.
interface ASNotationDeclaration : ASObject { attribute DOMString systemId; attribute DOMString publicId; };
This section contains "Validation and Other" methods common to
both the document-editing and AS-editing worlds (includes
DOMImplementation
methods).
This interface extends the Document
interface with
additional methods for both document and AS editing.
interface DocumentAS { attribute ASModel activeASModel; attribute ASObjectList boundASModels; ASModel getInternalAS(); void setInternalAS(in ASModel as); void addAS(in ASModel as); void removeAS(in ASModel as); ASElementDeclaration getElementDeclaration() raises(DOMException); void validate() raises(DOMASException); };
activeASModel
of type ASModel
ASModel
is responsible for consulting the internal ASModel, so if an
attribute is declared in the internal ASModel
and the corresponding ownerElements
points to a ASElementDeclaration
s
defined in the active external ASModel, changing the active
external ASModel will cause the ownerElements
to be
recomputed. If the ownerElements
is not defined in the
newly active external ASModel, the ownerElements
will
be an empty node list.boundASModels
of type ASObjectList
ASObject
s
of type AS_MODEL
s associated with a document. The
addAS
method associates a ASModel
with a document.addAS
getElementDeclaration
ASElementDeclaration object if the implementation supports
" |
|
NOT_FOUND_ERR: Raised if no |
getInternalAS
removeAS
setInternalAS
validate
This interface allows creation of an ASModel
.
The expectation is that an instance of the
DOMImplementationAS
interface can be obtained by using
binding-specific casting methods on an instance of the
DOMImplementation
interface when the DOM
implementation supports the feature "AS-EDIT
".
interface DOMImplementationAS { ASModel createAS(in boolean isNamespaceAware); DOMASBuilder createDOMASBuilder(); DOMASWriter createDOMASWriter(); };
createAS
createDOMASBuilder
DOMASBuilder
.
DOMImplementationLS.createDOMBuilder
?createDOMASWriter
This section contains "Document-editing" methods (includes
Node
, Element
, Text
and
Document
methods).
A DOM application may use the hasFeature(feature,
version)
method of the DOMImplementation
interface with parameter values "AS-DOC" and "3.0" (respectively)
to determine whether or not the Document-Editing interfaces of the
Abstract Schemas module are supported by the implementation.
This interface extends the NodeEditAS
interface with additional methods for both document and AS
editing.
interface DocumentEditAS : NodeEditAS { attribute boolean continuousValidityChecking; };
continuousValidityChecking
of type boolean
true
will result in an exception being thrown, i.e.,
VALIDATION_ERR
, for documents that are invalid at the
time of the call. If the document is invalid, then this attribute
will remain false
. This attribute is
false
by default.
This interface extends a Node
from [DOM Level 3
Core] with additional methods for guided document editing. The
expectation is that an instance of the DOMImplementationAS
interface can be obtained by using binding-specific casting methods
on an instance of the DOMImplementation
interface when
the DOM implementation supports the feature
"AS-DOC
".
interface NodeEditAS { // ASCheckType const unsigned short WF_CHECK = 1; const unsigned short NS_WF_CHECK = 2; const unsigned short PARTIAL_VALIDITY_CHECK = 3; const unsigned short STRICT_VALIDITY_CHECK = 4; boolean canInsertBefore(in Node newChild, in Node refChild); boolean canRemoveChild(in Node oldChild); boolean canReplaceChild(in Node newChild, in Node oldChild); boolean canAppendChild(in Node newChild); boolean isNodeValid(in boolean deep, in unsigned short wFValidityCheckLevel) raises(DOMASException); };
An integer indicating which type of validation this is.
NS_WF_CHECK
WF_CHECK
.PARTIAL_VALIDITY_CHECK
NS_WF_CHECK
.STRICT_VALIDITY_CHECK
NS_WF_CHECK
.WF_CHECK
canAppendChild
AppendChild
.
newChild
of type
Node
Node
to be appended.
|
|
canInsertBefore
insertBefore
operation from the Node
interface would make this document invalid with respect to the
currently active AS.
newChild
of type
Node
Node
to be inserted.refChild
of type
Node
Node
.
|
|
canRemoveChild
RemoveChild
.
oldChild
of type
Node
Node
to be removed.
|
|
canReplaceChild
ReplaceChild
.
newChild
of type
Node
Node
.oldChild
of type
Node
Node
to be replaced.
|
|
isNodeValid
deep
of type
boolean
deep
flag on causes the
isNodeValid
method to check for the whole subtree of
the current node for validity. Setting it to false
only checks the current node and its immediate child nodes. The
validate
method on the DocumentAS
interface, however, checks to determine whether the entire document
is valid.wFValidityCheckLevel
of
type unsigned short
|
|
|
This interface extends the Element
interface with
additional methods for guided document editing. An object
implementing this interface must also implement NodeEditAS
interface.
interface ElementEditAS : NodeEditAS { readonly attribute NodeList definedElementTypes; unsigned short contentType(); boolean canSetAttribute(in DOMString attrname, in DOMString attrval); boolean canSetAttributeNode(in Attr attrNode); boolean canSetAttributeNS(in DOMString name, in DOMString attrval, in DOMString namespaceURI); boolean canRemoveAttribute(in DOMString attrname); boolean canRemoveAttributeNS(in DOMString attrname, in DOMString namespaceURI); boolean canRemoveAttributeNode(in Node attrNode); NodeList getChildElements(); NodeList getParentElements(); NodeList getAttributeList(); boolean isElementDefined(in DOMString elemTypeName); boolean isElementDefinedNS(in DOMString elemTypeName, in DOMString namespaceURI, in DOMString name); };
definedElementTypes
of type NodeList
, readonlycanRemoveAttribute
attrname
of type
DOMString
|
|
canRemoveAttributeNS
attrname
of type
DOMString
namespaceURI
of type
DOMString
|
|
canRemoveAttributeNode
attrNode
of type
Node
Attr
node to remove from the attribute
list.
|
|
canSetAttribute
attrname
of type
DOMString
attrval
of type
DOMString
|
|
canSetAttributeNS
setAttributeNS
.
name
of type
DOMString
attrval
of type
DOMString
namespaceURI
of type
DOMString
namespaceURI
of namespace.
|
|
canSetAttributeNode
attrNode
of type
Attr
Node
in which the attribute can possibly be
set.
|
|
contentType
|
Constant for one of EMPTY_CONTENTTYPE, ANY_CONTENTTYPE, MIXED_CONTENTTYPE, ELEMENTS_CONTENTTYPE. |
getAttributeList
NodeList
containing all
the possible Attr
s that can appear with this type of
element.
|
List of possible attributes of this element. |
getChildElements
NodeList
containing the
possible Element
names that can appear as children of
this type of element.
|
List of possible children element types of this element. |
getParentElements
NodeList
containing the
possible Element
names that can appear as a parent of
this type of element.
|
List of possible parent element types of this element. |
isElementDefined
elemTypeName
of type
DOMString
|
A boolean that is |
isElementDefinedNS
elemTypeName
of type
DOMString
namespaceURI
of type
DOMString
namespaceURI
of namespace.name
of type
DOMString
|
A boolean that is |
This interface extends the NodeEditAS
interface with additional methods for document editing. An object
implementing this interface must also implement NodeEditAS
interface.
interface CharacterDataEditAS : NodeEditAS { readonly attribute boolean isWhitespaceOnly; boolean canSetData(in unsigned long offset, in unsigned long count); boolean canAppendData(in DOMString arg); boolean canReplaceData(in unsigned long offset, in unsigned long count, in DOMString arg); boolean canInsertData(in unsigned long offset, in DOMString arg); boolean canDeleteData(in unsigned long offset, in unsigned long count); };
isWhitespaceOnly
of type boolean
, readonlytrue
if content only whitespace;
false
for non-whitespace.canAppendData
arg
of type
DOMString
|
|
canDeleteData
offset
of type
unsigned long
count
of type
unsigned long
|
|
canInsertData
offset
of type
unsigned long
arg
of type
DOMString
|
|
canReplaceData
offset
of type
unsigned long
count
of type
unsigned long
arg
of type
DOMString
|
|
canSetData
offset
of type
unsigned long
count
of type
unsigned long
|
|
Editing and generating an abstract schema falls in the AS-editing world. The most obvious requirement for this set of requirements is for tools that author abstract schemas, either under user control, i.e., explicitly designed document types, or generated from other representations. The latter class includes transcoding tools, e.g., synthesizing an XML representation to match a database schema.
It's important to note here that a DTD's "internal subset" is part of the Abstract Schema, yet is loaded, stored, and maintained as part of the individual document instance. This implies that even tools which do not want to let users change the definition of the Document Type may need to support editing operations upon this portion of the AS. It also means that our representation of the AS must be aware of where each portion of its content resides, so that when the serializer processes this document it can write out just the internal subset. A similar issue may arise with external parsed entities, or if schemas introduce the ability to reference other schemas. Finally, the internal-subset case suggests that we may want at least a two-level representation of abstract schemas, so a single DOM representation of a DTD can be shared among several documents, each potentially also having its own internal subset; it's possible that entity layering may be represented the same way.
The API for altering the abstract schema may also be the AS's official interface with parsers. One of the ongoing problems in the DOM is that there is some information which must currently be created via completely undocumented mechanisms, which limits the ability to mix and match DOMs and parsers. Given that specialized DOMs are going to become more common (sub-classed, or wrappers around other kinds of storage, or optimized for specific tasks), we must avoid that situation and provide a "builder" API. Particular pairs of DOMs and parsers may bypass it, but it's required as a portability mechanism.
Note that several of these applications require that an AS be
able to be created, loaded, and manipulated without/before being
bound to a specific Document. A related issue is that we'd want to
be able to share a single representation of an AS among several
documents, both for storage efficiency and so that changes in the
AS can quickly be tested by validating it against a set of
known-good documents. Similarly, there is a known problem in [DOM Level 3
Core] where we assume that the DocumentType
will
be created before the Document
, which is fine for
newly-constructed documents but not a good match for the order in
which an XML parser encounters this data; being able to "rebind" a
Document
to a new AS, after it has been created may be
desirable.
As noted earlier, questions about whether one can alter the content of the AS via its syntax, via higher-level abstractions, or both, exist. It's also worth noting that many of the editing concepts from the Document tree still apply; users should probably be able to clone part of an AS, remove and re-insert parts, and so on.
In addition to using the abstract schema to validate a document instance, applications would like to be able to use it to guide construction and editing of documents, which falls into the document-editing world. Examples of this sort of guided editing already exist, and are becoming more common. The necessary queries can be phrased in several ways, the most useful of which may be a combination of "what does the DTD allow me to insert here" and "if I insert this here, will the document still be valid". The former is better suited to presentation to humans via a user interface, and when taken together with sub-tree validation may subsume the latter.
It has been proposed that in addition to asking questions about specific parts of the abstract schema, there should be a reasonable way to obtain a list of all the defined symbols of a given type (element, attribute, entity) independent of whether they're valid in a given location; that might be useful in building a list in a user-interface, which could then be updated to reflect which of these are relevant for the program's current state.
Remember that namespaces also weigh in on this issue, in the case of attributes, a "can-this-go-there" may prompt a namespace-well-formedness check and warn you if you're about to conflict with or overwrite another attribute with the same namespaceURI/localName but different prefix, or same nodeName but different namespaceURI.
We have to deal with the fact that "the shortest distance between two valid documents may be through an invalid one". Users may want to know several levels of detail (all the possible children, those which would be valid given what precedes this point, those which would be valid given both preceding and following siblings). Also, once XML Schemas introduce context sensitive validity, we may have to consider the effect of children as well as the individual node being inserted.
The most obvious use for an abstract schema (DTD or XML Schema or any Abstract Schema) is to use it to validate that a given XML document is in fact a properly constructed instance of the document type described by this AS. This again falls into the document-editing world. The XML spec only discusses performing this test at the time the document is loaded into the "processor", which most of us have taken to mean that this check should be performed at parse time. But it is obviously desirable to be able to validate again a document -- or selected subtrees -- at other times. One such case would be validating an edited or newly constructed document before serializing it or otherwise passing it to other users. This issue also arises if the "internal subset" is altered -- or if the whole Abstract Schema changes.
In the past, the DOM has allowed users to create invalid
documents, and assumed the serializer would accept the task of
detecting problems and announcing/repairing them when the document
was written out in XML syntax... or that they would be checked for
validity when read back in. We considered adding validity checks to
the DOM's existing editing operations to prevent creation of
invalid documents, but are currently inclined against this for
several reasons. First, it would impose a significant amount of
computational overhead to the DOM, which might be unnecessary in
many situations, e.g., if the change is occurring in a context
where we know the result will be valid. Second, "the shortest
distance between two good documents may be through a bad document".
Preventing a document from becoming temporarily invalid may impose
a considerable amount of additional work on higher-level code and
users Hence our current plan is to continue to permit editing to
produce invalid DOMs, but provide operations which permit a user to
check the validity of a node on demand. If needed one can use
continuousValidityChecking
flag to ensure that the DOM
remains valid during the editing process.
Note that validation includes checking that ID attributes are unique, and that IDREFs point to IDs which actually exist.
XML defined the "well-formed" (WF) state for documents which are parsed without reference to their DTDs. Knowing that a document is well-formed may be useful by itself even when a DTD is available. For example, users may wish to deliberately save an invalid document, perhaps as a checkpoint before further editing. Hence, the AS feature will permit both full validity checking (see previous section) and "lightweight" WF checking, as requested by the caller, as well as processing entity declarations in the AS even if validation is not turned on. This falls within the document-editing world.
While the DOM inherently enforces some of XML's well-formedness conditions (proper nesting of elements, constraints on which children may be placed within each node), there are some checks that are not yet performed. These include:
In addition, Namespaces introduce their own concepts of well-formedness. Specifically:
namespaceNormalize
operation, which would
create the implied declarations and reconcile conflicts in some
reasonably standardized manner. This may be a major undertaking,
since some DOMs may be using the namespace to direct subclassing of
the nodes or similar special treatment; as with the existing
normalize
method, you may be left with a
different-but-equivalent set of node objects.In the past, the DOM has allowed users to create documents which violate these rules, and assumed the serializer would accept the task of detecting problems and announcing/repairing them when the document was written out in XML syntax. We considered adding WF checks to the DOM's existing editing operations to prevent WF violations from arising, but are currently inclined against this for two reasons. First, it would impose a significant amount of computational overhead to the DOM, which might be unnecessary in many situations (for example, if the change is occurring in a context where we know the illegal characters have already been prevented from arising). Second, "the shortest distance between two good documents may be through a bad document" -- preventing a document from becoming temporarily ill-formed may impose a considerable amount of additional work on higher-level code and users. (Note possible issue for Serialization: In some applications, being able to save and reload marginally poorly-formed DOMs might be useful -- editor checkpoint files, for example.) Hence our current plan is to continue to permit editing to produce ill-formed DOMs, but provide operations which permit a user to check the well-formedness of a node on demand, and possibly provide some of the primitive (e.g., string-checking) functions directly.
The module extends the Document Object Model Load and Save
module to permit to load a Document
using a specific
ASModel
and to load an ASModel
from an URI or DOMInputSource
.
A DOM application may use the hasFeature(feature,
version)
method of the DOMImplementation
interface with parameter values "AS-LS" and "3.0" (respectively) to
determine whether or not the Load and Save for Abstract Schemas
module is supported by the implementation. In order to fully
support this module, an implementation must also support the
"AS-EDIT
" features defined in this specification.
An Abstract Schema parser interface.
DOMASBuilder
provides an API for parsing Abstract
Schemas and building the corresponding ASModel
tree.
interface DOMASBuilder : ls::DOMBuilder { attribute ASModel abstractSchema; ASModel parseASURI(in DOMString uri) raises(DOMASException, DOMSystemException); ASModel parseASInputSource(in ls::DOMInputSource is) raises(DOMASException, DOMSystemException); };
abstractSchema
of type ASModel
ASModel
with a DOMBuilder
.
This ASModel
will be used by the "validate-if-schema
" and
"datatype-normalization
" options during the load of a
new Document
.parseASInputSource
DOMInputSource
.
is
of type
ls::DOMInputSource
DOMInputSource
from which the source Abstract Schema is to be read.
Exceptions raised by Raise a WRONG_MIME_TYPE_ERR when |
|
|
Exceptions raised by |
parseASURI
uri
of type
DOMString
The newly created Abstract Schema. |
Exceptions raised by WRONG_MIME_TYPE_ERR: Raised when |
|
|
Exceptions raised by |
A Abstract Schema serialization interface.
DOMASWriters provides an API for serializing Abstract Schemas out in the form of a source Abstract Schema. The Abstract Schema is written to an output stream, the type of which depends on the specific language bindings in use.
DOMASWriter is a generic Abstract Schema serialization
interface. It can be applied to both an internal Abstract Schema
and/or an external Abstract Schema. DOMASWriter is applied to
serialize a single Abstract Schema. Serializing a document with an
active Internal Abstract Schema will serialize this internal
Abstract Schema with the document as it is part of the Document
(see DOMWriter
).
interface DOMASWriter : ls::DOMWriter { void writeASModel(in DOMOutputStream destination, in ASModel model) raises(DOMSystemException); };
writeASModel
destination
of type
DOMOutputStream
model
of type ASModel
|
This exception will be raised in response to any sort of IO or system error that occurs while writing to the destination. It may wrap an underlying system exception. |
DOM Level 3 will provide an API for loading XML documents into a DOM representation and for saving a DOM representation as a XML document.
Some environments, such as the Java [Java] or COM [COM], have their own ways to persist objects to streams and to restore them. There is no direct relationship between these mechanisms and the DOM load/save mechanism. This specification defines how to serialize documents only to and from XML format.
Requirements that apply to both loading and saving documents.
Documents must be able to be parsed from and saved to the following sources:
Note that Input and Output streams take care of the in memory case. One point of caution is that a stream doesn't allow a base URI to be defined against which all relative URIs in the document are resolved.
While creating a new document using the DOM API, a mechanism must be provided to specify that the new document uses a pre-existing Abstract Schema and to cause that Abstract Schema to be loaded.
Note that while DOM Level 2 creation can specify a Abstract Schema when creating a document (public and system IDs for the external subset, and a string for the subset), DOM Level 2 implementations do not process the Abstract Schema's content. For DOM Level 3, the Abstract Schema's content must be read.
When processing a series of documents, all of which use the same Abstract Schema, implementations should be able to reuse the already parsed and loaded Abstract Schema rather than parsing it again for each new document.
This feature may not have an explicit DOM API associated with it, but it does require that nothing in this section, or the Abstract Schema section, of this specification block it or make it difficult to implement.
Some means is required to allow applications to map public and system IDs to the correct document. This facility should provide sufficient capability to allow the implementation of catalogs, but providing catalogs themselves is not a requirement. In addition XML Base needs to be addressed.
Loading a document can cause the generation of errors including:
Saving a document can cause the generation of errors including:
This section, as well as the DOM Level 3 Abstract Schema section should use a common error reporting mechanism. Well-formedness and validity checking are in the domain of the Abstract Schema section, even though they may be commonly generated in response to an application asking that a document be loaded.
The following requirements apply to loading documents.
Parsers may have properties or options that can be set by applications. Examples include:
A mechanism to set properties, query the state of properties, and to query the set of properties supported by a particular DOM implementation is required.
The fundamental requirement is to write a DOM document as XML source. All information to be serialized should be available via the normal DOM API.
There are several options that can be defined when saving an XML document. Some of these are:
The following items are not committed to, but are under consideration. Public feedback on these items is especially requested.
Note: This is done with the asynch loading.
Provide the ability for a thread that requested the loading of a document to continue execution without blocking while the document is being loaded. This would require some sort of notification or completion event when the loading process was done.
Provide the ability to examine the partial DOM representation before it has been fully loaded.
In one form, a document may be loaded asynchronously while a DOM based application is accessing the document. In another form, the application may explicitly ask for the next incremental portion of a document to be loaded.
Provide the capability to write out only a part of a document. May be able to leverage TreeWalkers, or the Filters associated with TreeWalkers, or Ranges as a means of specifying the portion of the document to be written.
Note: Won't happen.
Document fragments, as specified by the XML Fragment specification, should be able to be loaded. This is useful to applications that only need to process some part of a large document. Because the DOM is typically implemented as an in-memory representation of a document, fully loading large documents can require large amounts of memory.
XPath should also be considered as a way to identify XML Document fragments to load.
Document fragments, as specified by the XML Fragment specification, should be able to be loaded into the context of an existing document at a point specified by a node position, or perhaps a range. This is a separate feature than simply loading document fragments as a new Node.
SKIP
an element in
DOMBuilderFilter::endNode
?namespaceURI
in core can be empty string, how
should that be dealt with in DOM LS?DocumentBuilder
(Sun) and DOMParser
(Xerces).SAXException.toString
and
SAXException.getMessage
always the same? If not, we
need to add another attribute.true
.DOMASBuilder
interface in the AS specDOMASBuilder
interface in the AS specDOMSystemException
needs to
be defined as part of the error handling module that is to be
shared with AS. Common I/O type errors need to be defined for it,
so that they can be reported in a uniform way. A way to embed
errors or exceptions from the OS or language environment is needed,
to provide full information to applications that want it.false
. Does this mean
that the default depends on the parser, or that some sort of an
error happens if a parse is attempted before resetting the
property, or what?false
.false
? Discussed at f2f. I'm not so sure now. Some of
the properties have somewhat non-standard behavior when
false
- leaving out ER nodes or whitespace, for
example - and support of false
will probably not even
be required.false
. But validation should.true
. Illegal for it to be false
and
createEntityReferenceNodes to be true
.
DOMBuilder
.true
during serialization that these changes
are discarded during serialization.false
then
the attribute must be a level 1 node in which case this information
can safely be used.This section defines an API for loading (parsing) XML documents [XML] into a DOM representation [DOM Level 3 Core] and for saving (serializing) a DOM representation as an XML document.
The proposal for loading is influenced by the Java APIs for XML Processing [JAXP] and by SAX2 [SAX].
The list of interfaces involved with the Loading and Saving XML documents is:
DOMImplementationLS
-- A new DOMImplementation
interface that provides the
factory methods for creating the objects required for loading and
saving.DOMBuilder
-- A parser interface.DOMInputSource
-- Encapsulate information about the XML document to be
loaded.DOMEntityResolver
-- During loading, provides a way for applications to redirect
references to external entities.DOMBuilderFilter
-- Provide the ability to examine and optionally remove Element
nodes as they are being processed during the parsing of a
document.DOMWriter
-- An interface for writing out or serializing DOM documents.DocumentLS
-- Provides a client or browser style interface for loading and
saving.ParseErrorEvent
-- ParseErrorEvent is the event that is fired if there's an error
in the XML document being parsed using the methods of
DocumentLS.DOMImplementationLS
contains the factory methods
for creating objects that implement the DOMBuilder
(parser) and DOMWriter
(serializer) interfaces.
An object that implements DOMImplementationLS is obtained by doing a binding specific cast from DOMImplementation to DOMImplementationLS. Implementations supporting the Load and Save feature must implement the DOMImplementationLS interface on whatever object implements the DOMImplementation interface.
interface DOMImplementationLS { // DOMIMplementationLSMode const unsigned short MODE_SYNCHRONOUS = 1; const unsigned short MODE_ASYNCHRONOUS = 2; DOMBuilder createDOMBuilder(in unsigned short mode) raises(DOMException); DOMWriter createDOMWriter(); DOMInputSource createDOMInputSource(); };
An integer indicating which type of mode this is.
MODE_ASYNCHRONOUS
DOMBuilder
.MODE_SYNCHRONOUS
DOMBuilder
.createDOMBuilder
DOMBuilder
.
The newly constructed parser may then be configured by means of its
setFeature
method, and used to parse documents by
means of its parse
method.
mode
of type unsigned
short
mode
argument is either
MODE_SYNCHRONOUS
or MODE_ASYNCHRONOUS
, if
mode
is MODE_SYNCHRONOUS
then the DOMBuilder
that is created will operate in synchronous mode, if it's
MODE_ASYNCHRONOUS
then the DOMBuilder
that is created will operate in asynchronous mode.
The newly created |
|
Raise a NOT_SUPPORTED_ERR exception if MODE_ASYNCHRONOUS is not supported. |
createDOMInputSource
DOMInputSource
.
The newly created |
createDOMWriter
A interface to an object that is able to build a DOM tree from various input sources.
DOMBuilder
provides an API for parsing XML
documents and building the corresponding DOM document tree. A
DOMBuilder
instance is obtained from the DOMImplementationLS
interface by invoking its createDOMBuilder
method.
As specified in [DOM Level 3 Core], when a document is first made available via the DOMBuilder:
Text
node for each block of
text. The Text
nodes are into "normal" form: only
structure (e.g., elements, comments, processing instructions, CDATA
sections, and entity references) separates Text
nodes,
i.e., there are neither adjacent Text
nodes nor empty
Text
nodes.value
and
nodeValue
attributes of an Attr
node
initially return the XML
1.0 normalized value. However, if the features
validate-if-schema
and
datatype-normalization
are set to true
,
depending on the attribute normalization used, the attribute values
may differ from the ones obtained by the XML 1.0 attribute
normalization. If the feature
datatype-normalization
is not set to
true
, the XML 1.0 attribute normalization is garantee
to occur, and if attributes list does not contain namespace
declarations, the attributes
attribute on
Element
node represents the property [attributes]
defined in [XML Information set] .
datatype-normalization
is set to
true
.The Document Object Model Level 3 Load and Save does not provide a way to disable the namespace resolution: Namespaces are always taken into account during loading and saving operations.
Asynchronous DOMBuilder
objects are expected to
also implement the events::EventTarget
interface so
that event listeners can be registerd on asynchronous
DOMBuilder
objects.
Events supported by asynchronous DOMBuilder
are:
LSLoadEvent
LSProgressEvent
DOMBuilder
s have a number of named features that
can be queried or set. The name of DOMBuilder
features
must be valid XML names. Implementation specific features
(extensions) should choose a implementation specific prefix to
avoid name collisions.
Even if all features must be recognized by all implementations,
being able to set a state (true
or false
)
is not always required. The following list of recognized features
indicates the definitions of each feature state, if setting the
state to true
or false
must be supported
or is optional and, which state is the default one:
"namespace-declarations"
true
false
false
."validation"
true
true
also will
force the external-general-entities
and
external-parameter-entities
features to be
true
.) Also note that the
validate-if-schema
feature will alter the validation
behavior when this feature is set true
.false
"external-parameter-entities"
true
false
true
"external-general-entities"
true
false
"external-dtd-subset"
true
false
"validate-if-schema"
true
true
,
enable validation only if the document being processed has a schema
(i.e. XML schema, DTD, any other type of schema, note that this is
unrelated to the abstract schema specification). Documents without
schemas are parsed without validation.false
"validate-against-dtd"
true
false
"datatype-normalization"
true
false
"create-entity-ref-nodes"
true
EntityReference
nodes in the DOM document. It
will also set create-entity-nodes
to be
true
.false
EntityReference
nodes from the DOM document,
putting the entity expansions directly in their place.
Text
nodes are into "normal" form.
EntityReference
nodes to non-defined entities will
still be created in the DOM document."create-entity-nodes"
true
Entity
nodes in the DOM document.false
entity
nodes from the DOM document. It will
also set create-entity-ref-nodes
to
false
."whitespace-in-element-content"
true
false
"create-cdata-nodes"
true
CDATASection
nodes in response to the
appearance of CDATA sections in the XML document.false
CDATASection
nodes in the DOM
document.Text
node, i.e. the Text
nodes are into "normal" form."comments"
true
false
Comment
nodes in
the DOM Document resulting from a parse."charset-overrides-xml-encoding"
true
DOMInputSource
overrides encodings from the protocol.false
"load-as-infoset"
true
false
:
namespace-declarations
,
validate-if-schema
,
create-entity-ref-nodes
,
create-entity-nodes
,
create-cdata-nodes
.true
:
datatype-normalization
,
whitespace-in-element-content
, comments
,
charset-overrides-xml-encoding
.getFeature
will
return true
only if the individual features specified
above are appropriately set.false
load-as-infoset
to false
has
no effect."supported-mediatypes-only"
true
false
interface DOMBuilder { attribute DOMEntityResolver entityResolver; attribute DOMErrorHandler errorHandler; attribute DOMBuilderFilter filter; void setFeature(in DOMString name, in boolean state) raises(DOMException); boolean canSetFeature(in DOMString name, in boolean state); boolean getFeature(in DOMString name) raises(DOMException); Document parseURI(in DOMString uri) raises(DOMSystemException); Document parse(in DOMInputSource is) raises(DOMSystemException); // ACTION_TYPES const unsigned short ACTION_REPLACE = 1; const unsigned short ACTION_APPEND = 2; const unsigned short ACTION_INSERT_AFTER = 3; const unsigned short ACTION_INSERT_BEFORE = 4; void parseWithContext(in DOMInputSource is, in Node cnode, in unsigned short action) raises(DOMException); };
A set of possible actions for the parseWithContext
method.
ACTION_APPEND
Element
.ACTION_INSERT_AFTER
Element
.ACTION_INSERT_BEFORE
Element
.ACTION_REPLACE
Element
, Text
, CDATASection
,
Comment
, ProcessingInstruction
, or
EntityReference
node.entityResolver
of type
DOMEntityResolver
DOMEntityResolver
has been specified, each time a reference to an external entity is
encountered the DOMBuilder
will pass the public and
system IDs to the entity resolver, which can then specify the
actual source of the entity.errorHandler
of type
DOMErrorHandler
DOMDcoumentBuilder
will call back to
the errorHandler
with the error information. When the
document loading process calls the error handler the node closest
to where the error occured is passed to the error handler if the
implementation, if the implementation is unable to pass the node
where the error occures the document Node is passed to the error
handler. Mutations to the document from within an error handler
will result in implementation dependent behavour.filter
of type DOMBuilderFilter
Element
node. The filter implementation can choose to
remove the element from the document being constructed (unless the
element is the document element) or to terminate the parse early.
If the document is being validated when it's loaded the validation
happens before the filter is called.canSetFeature
name
of type
DOMString
state
of type
boolean
true
or
false
).
|
|
getFeature
name
of type
DOMString
|
The current state of the feature ( |
|
Raise a NOT_FOUND_ERR When the |
parse
DOMInputSource
.
is
of type DOMInputSource
DOMInputSource
from which the source document is to be read.
|
If the |
|
Exceptions raised by |
parseURI
uri
of type
DOMString
|
If the |
|
Exceptions raised by |
parseWithContext
DOMInputSource
and insert the content into an existing document at the position
epcified with the contextNode
and action
arguments. When parsing the input stream the context node is used
for resolving unbound namespace prefixes.
is
of type DOMInputSource
DOMInputSource
from which the source document is to be read.cnode
of type
Node
Node
that is used as the context for the data
that is being parsed.action
of type
unsigned short
|
HIERARCHY_REQUEST_ERR: Thrown if this action results in an invalid hierarchy (i.e. a Document with more than one document element). |
setFeature
DOMBuilder
to recognize a feature
name but to be unable to set its value.
name
of type
DOMString
state
of type
boolean
true
or
false
).
|
Raise a NOT_SUPPORTED_ERR exception when the
Raise a NOT_FOUND_ERR When the |
DOMWriter provides an API for serializing (writing) a DOM document out in an XML document. The XML data is written to an output stream, the type of which depends on the specific language bindings in use. During serialization of XML data, namespace fixup is done when possible.
DOMWriter
accepts any node type for serialization.
For nodes of type Document
or Entity
,
well formed XML will be created if possible. The serialized output
for these node types is either as a Document or an External Entity,
respectively, and is acceptable input for an XML parser. For all
other types of nodes the serialized form is not specified, but
should be something useful to a human for debugging or diagnostic
purposes. Note: rigorously designing an external (source) form for
stand-alone node types that don't already have one defined in [XML] seems
a bit much to take on here.
Within a Document or Entity being serialized, Nodes are processed as follows
writeNode
defined in the DOMWriter
interface, output the entity
expansion but no namespace fixup is done. The resulting output will
be valid as an external entity."&entityName;"
) in the output. Child
nodes (the expansion) of the entity reference are ignored.true
, CDATA sections are split, and
the unrepresentable characters are serialized as numeric character
references in ordinary content. The exact position and number of
splits is not specified.false
, unrepresentable characters
in a CDATA section are reported as errors. The error is not
recoverable - there is no mechanism for supplying alternative
characters and continuing with the serialization.Within the character data of a document (outside of markup), any characters that cannot be represented directly are replaced with character references. Occurrences of '<' and '&' are replaced by the predefined entities < and &. The other predefined entities (>, &apos, etc.) are not used; these characters can be included directly. Any character that can not be represented directly in the output character encoding is serialized as a numeric character reference.
Attributes not containing quotes are serialized in quotes. Attributes containing quotes but no apostrophes are serialized in apostrophes (single quotes). Attributes containing both forms of quotes are serialized in quotes, with quotes within the value represented by the predefined entity ". Any character that can not be represented directly in the output character encoding is serialized as a numeric character reference.
Within markup, but outside of attributes, any occurrence of a character that cannot be represented in the output character encoding is reported as an error. An example would be serializing the element <LaCañada/> with the encoding="us-ascii".
When requested by setting the normalize-characters
feature on DOMWriter
, all data to be serialized, both
markup and character data, is W3C Text normalized according to the
rules defined in [CharModel]. The W3C Text
normalization process affects only the data as it is being written;
it does not alter the DOM's view of the document after
serialization has completed.
Namespaces are fixed up during serialization, the serialization process will verify that namespace declarations, namespace prefixes and the namespace URIs associated with Elements and Attributes are consistent. If inconsistencies are found, the serialized form of the document will be altered to remove them. The algorithm used for doing the namespace fixup while seralizing a document is a combination of the algorithms used for lookupNamespaceURI and lookupNamespacePrefix .
Any changes made affect only the namespace prefixes and declarations appearing in the serialized data. The DOM's view of the document is not altered by the serialization operation, and does not reflect any changes made to namespace declarations or prefixes in the serialized output.
While serializing a document the serializer will write out
non-specified values (such as attributes whose
specified
is false
) if the
output-default-values
feature is set to
true
. If the output-default-values
flag
is set to false
and the
use-abstract-schema
feature is set to
true
the abstract schema will be used to determine if
a value is specified or not, if use-abstract-schema
is
not set the specified
flag on attribute nodes is used
to determine if attribute values should be written out.
Ref to Core spec (1.1.9, XML namespaces, 5th paragraph) entity ref description about warning about unbound entity refs. Entity refs are always serialized as &foo;, also mention this in the load part of this spec.
When serializing a document the DOMWriter checks to see if the document element in the document is a DOM Level 1 element or a DOM Level 2 (or higher) element (this check is done by looking at the localName of the root element). If the root element is a DOM Level 1 element then the DOMWriter will issue an error if a DOM Level 2 (or higher) element is found while serializing. Likewise if the document element is a DOM Level 2 (or higher) element and the DOMWriter sees a DOM Level 1 element an error is issued. Mixing DOM Level 1 elements with DOM Level 2 (or higher) is not supported.
DOMWriter
s have a number of named features that can
be queried or set. The name of DOMWriter
features must
be valid XML names. Implementation specific features (extensions)
should choose an implementation dependent prefix to avoid name
collisions.
Here is a list of properties that must be recognized by all implementations.
"normalize-characters"
true
false
"split-cdata-sections"
true
false
CDATASection
contains an
unrepresentable character."validation"
true
use-abstract-schema
to true
.false
"expand-entity-references"
true
EntityReference
nodes when serializing.false
EntityReference
nodes as XML entity
references."whitespace-in-element-content"
true
false
isWhitespaceInElementContent
flag on Text
nodes to determine if a text node should be written out or
not."discard-default-content"
true
specified
flag on Attr
nodes, and so on) to decide what attributes and content should be
serialized or not. Note that the specified
flag on
Attr
nodes in itself is not always reliable, it is
only reliable when it is set to false
since the only
case where it can be set to false
is if the attribute
was created by a Level 1 implementation.false
"format-canonical"
true
false
"format-pretty-print"
true
false
interface DOMWriter { void setFeature(in DOMString name, in boolean state) raises(DOMException); boolean canSetFeature(in DOMString name, in boolean state); boolean getFeature(in DOMString name) raises(DOMException); attribute DOMString encoding; readonly attribute DOMString lastEncoding; attribute DOMString newLine; attribute DOMErrorHandler errorHandler; boolean writeNode(in DOMOutputStream destination, in Node wnode) raises(DOMSystemException); DOMString writeToString(in Node wnode) raises(DOMException); };
encoding
of type
DOMString
null
or empty, but
the item to be written includes an encoding declaration, that value
will be used.null
.errorHandler
of type
DOMErrorHandler
lastEncoding
of type
DOMString
, readonlynewLine
of type
DOMString
null
null
.canSetFeature
name
of type
DOMString
state
of type
boolean
true
or
false
).
|
|
getFeature
name
of type
DOMString
|
The current state of the feature ( |
|
Raise a NOT_FOUND_ERR When the |
setFeature
DOMWriter
to recognize a feature
name but to be unable to set its value.
name
of type
DOMString
state
of type
boolean
true
or
false
).
|
Raise a NOT_SUPPORTED_ERR exception when the
Raise a NOT_FOUND_ERR When the |
writeNode
DOMWriter
. Writing a Document or
Entity node produces a serialized form that is well formed XML.
Writing other node types produces a fragment of text in a form that
is not fully defined by this document, but that should be useful to
a human for debugging or diagnostic purposes.
destination
of type
DOMOutputStream
wnode
of type
Node
Document
or Entity
node to be
written. For other node types, something sensible should be
written, but the exact serialized form is not specified.
|
Returns |
|
This exception will be raised in response to any sort of IO or system error that occurs while writing to the destination. It may wrap an underlying system exception. |
writeToString
DOMWriter
. The result of
serializing the node is returned as a string. Writing a Document or
Entity node produces a serialized form that is well formed XML.
Writing other node types produces a fragment of text in a form that
is not fully defined by this document, but that should be useful to
a human for debugging or diagnostic purposes.
wnode
of type
Node
|
Returns the serialized data, or |
|
DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a
|
This interface represents a single input source for an XML entity.
This interface allows an application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), and/or a character stream.
The exact definitions of a byte stream and a character stream are binding dependent.
There are two places that the application will deliver this
input source to the parser: as the argument to the
parse
method, or as the return value of the DOMEntityResolver.resolveEntity
method.
The DOMBuilder
will use the DOMInputSource
object to determine how to
read XML input. If there is a character stream available, the
parser will read that stream directly; if not, the parser will use
a byte stream, if available; if neither a character stream nor a
byte stream is available, the parser will attempt to open a URI
connection to the resource identified by the system identifier.
An DOMInputSource
object belongs to the
application: the parser shall never modify it in any way (it may
modify a copy if necessary).
Note: Eventhough all attributes in this interface are writable the DOM implementation is expected to never mutate a DOMInputSource.
interface DOMInputSource { attribute DOMInputSource byteStream; attribute DOMReader characterStream; attribute DOMString stringData; attribute DOMString encoding; attribute DOMString publicId; attribute DOMString systemId; attribute DOMString baseURI; };
baseURI
of type
DOMString
byteStream
of type DOMInputSource
characterStream
of type DOMReader
encoding
of type
DOMString
publicId
of type
DOMString
stringData
of type
DOMString
systemId
of type
DOMString
This interface represents a load event object that signals the completion of a document load.
interface LSLoadEvent : events::Event { readonly attribute Document newDocument; readonly attribute DOMInputSource inputSource; };
inputSource
of type DOMInputSource
,
readonlynewDocument
of type
Document
, readonlyThis interface represents a progress event object that notifies the application about progress as a document is parsed. This event is optional and the rate at which this event is fired is implementation dependent.
interface LSProgressEvent : events::Event { readonly attribute DOMInputSource inputSource; readonly attribute unsigned long position; readonly attribute unsigned long totalSize; };
inputSource
of type
DOMInputSource
,
readonlyposition
of type
unsigned long
, readonlytotalSize
of type
unsigned long
, readonlyDOMEntityResolver
Provides a way for applications
to redirect references to external entities.
Applications needing to implement customized handling for
external entities must implement this interface and register their
implementation by setting the entityResolver
property
of the DOMBuilder
.
The DOMBuilder
will then allow the application to intercept any external entities
(including the external DTD subset and external parameter entities)
before including them.
Many DOM applications will not need to implement this interface, but it will be especially useful for applications that build XML documents from databases or other specialized input sources, or for applications that use URI types other than URIs.
Note: DOMEtityResolver
is based on the SAX2
[SAX]
EntityResolver
interface.
interface DOMEntityResolver { DOMInputSource resolveEntity(in DOMString publicId, in DOMString systemId, in DOMString baseURI) raises(DOMSystemException); };
resolveEntity
DOMBuilder
will call this method before opening any external entity except the
top-level document entity (including the external DTD subset,
external entities referenced within the DTD, and external entities
referenced within the document element); the application may
request that the DOMBuilder
resolve the entity itself, that it use an alternative URI, or that
it use an entirely different input source.DOMBuilder
must resolve it fully before reporting it to the application
through this interface.
publicId
of type
DOMString
null
if none was supplied.systemId
of type
DOMString
baseURI
of type
DOMString
null
if there is no base URI.
A |
|
Any |
DOMBuilderFilter
s provide applications the ability
to examine nodes as they are being constructed during a parse. As
each node is examined, it may be modified or removed, or the entire
parse may be terminated early.
At the time any of the filter methods are called by the parser,
the owner Document and DOMImplementation objects exist and are
accessible. The document element is never passed to the
DOMBuilderFilter
methods, i.e. it is not possible to
filter out the document element.
All validity checking while reading a document occurs on the source document as it appears on the input stream, not on the DOM document as it is built in memory. With filters, the document in memory may be a subset of the document on the stream, and its validity may have been affected by the filtering.
interface DOMBuilderFilter { unsigned long startNode(in Node snode); unsigned long endNode(in Node enode); readonly attribute unsigned long whatToShow; };
whatToShow
of type
unsigned long
, readonlyDOMBuilder
what types of nodes to show to the filter. See
NodeFilter
for definition of the constants. The
constant SHOW_ATTRIBUTE
is meaningless here, attribute
nodes will never be passed to a
DOMBuilderFilter
.endNode
enode
of type
Node
|
|
startNode
Element
start tag has been scanned, but before
the remainder of the Element
is processed. The intent
is to allow the element, including any children, to be efficiently
skipped. Note that only element nodes are passed to the
startNode
function.startNode
for filtering
will include all of the Element's attributes, but none of the
children nodes. The Element may not yet be in place in the document
being constructed (it may not have a parent node.)startNode
filter function may access or change the
attributers for the Element. Changing Namespace declarations will
have no effect on namespace resolution by the parser.snode
of type
Node
|
|
DOMWriterFilter
s provide applications the ability
to examine nodes as they are being serialized.
DOMWriterFilter
lets the application decide what nodes
should be serialized or not.
interface DOMWriterFilter : traversal::NodeFilter { readonly attribute unsigned long whatToShow; };
whatToShow
of type
unsigned long
, readonlyDOMWriter
what types of nodes to show to the filter. See
NodeFilter
for definition of the constants. The
constant SHOW_ATTRIBUTE
is meaningless here, attribute
nodes will never be passed to a DOMWriterFilter
.The DocumentLS interface provides a mechanism by which the content of a document can be replaced with the DOM tree produced when loading a URI, or parsing a string. The expectation is that an instance of the DocumentLS interface can be obtained by using binding-specific casting methods on an instance of the Document interface.
uses the default features.
interface DocumentLS { attribute boolean async; void abort(); boolean load(in DOMString uri); boolean loadXML(in DOMString source); DOMString saveXML(in Node snode) raises(DOMException); };
async
of type
boolean
true
the load method returns control to the caller before the document
has completed loading. The default value of this property is
false
.false
but we
need to check with Mozilla and IE.abort
load
being invoked the loading
and parsing is immediately aborted. The possibly partial result of
parsing the document is discarded and the document is cleared.
load
ParseErrorEvent
).
uri
of type
DOMString
|
If async is set to |
loadXML
source
of type
DOMString
|
|
saveXML
snode
of type
Node
null
the whole document is serialized, if it's
non-null the given node is serialized.
|
The serialized document or |
|
WRONG_DOCUMENT_ERR: Raised if the node passed in as the node parameter is from an other document. |
ParseErrorEvent is the event that is fired if there's an error in the XML document being parsed.
interface ParseErrorEvent : events::Event { readonly attribute DOMError error; };
error
of type
DOMError
, readonly0
if there is no error.This appendix contains the complete OMG IDL [OMGIDL] for the Level 3 Document Object Model Abstract Schemas and Load and Save definitions.
The IDL files are also available as: http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025/idl.zip
// File: as.idl #ifndef _AS_IDL_ #define _AS_IDL_ #include "dom.idl" #include "ls.idl" #pragma prefix "dom.w3c.org" module as { typedef dom::DOMString DOMString; typedef dom::Node Node; typedef dom::NodeList NodeList; typedef dom::Attr Attr; typedef dom::DOMOutputStream DOMOutputStream; interface ASModel; interface ASContentModel; interface ASAttributeDeclaration; interface DOMASBuilder; interface DOMASWriter; exception DOMASException { unsigned short code; }; // ASExceptionCode const unsigned short DUPLICATE_NAME_ERR = 1; const unsigned short TYPE_ERR = 2; const unsigned short NO_AS_AVAILABLE = 3; const unsigned short WRONG_MIME_TYPE_ERR = 4; interface ASObject { // ASObjectType const unsigned short AS_ELEMENT_DECLARATION = 1; const unsigned short AS_ATTRIBUTE_DECLARATION = 2; const unsigned short AS_NOTATION_DECLARATION = 3; const unsigned short AS_ENTITY_DECLARATION = 4; const unsigned short AS_CONTENTMODEL = 5; const unsigned short AS_MODEL = 6; readonly attribute unsigned short asNodeType; attribute ASModel ownerASModel; attribute DOMString nodeName; attribute DOMString prefix; attribute DOMString localName; attribute DOMString namespaceURI; ASObject cloneASObject(in boolean deep); }; interface ASObjectList { readonly attribute unsigned long length; ASObject item(in unsigned long index); }; interface ASNamedObjectMap { readonly attribute unsigned long length; ASObject getNamedItem(in DOMString name); ASObject getNamedItemNS(in DOMString namespaceURI, in DOMString localName); ASObject item(in unsigned long index); ASObject removeNamedItem(in DOMString name) raises(dom::DOMException); ASObject removeNamedItemNS(in DOMString namespaceURI, in DOMString localName) raises(dom::DOMException); ASObject setNamedItem(in ASObject newASObject) raises(dom::DOMException); ASObject setNamedItemNS(in ASObject newASObject) raises(dom::DOMException); }; interface ASDataType { readonly attribute unsigned short dataType; // DATA_TYPES const unsigned short STRING_DATATYPE = 1; const unsigned short NOTATION_DATATYPE = 10; const unsigned short ID_DATATYPE = 11; const unsigned short IDREF_DATATYPE = 12; const unsigned short IDREFS_DATATYPE = 13; const unsigned short ENTITY_DATATYPE = 14; const unsigned short ENTITIES_DATATYPE = 15; const unsigned short NMTOKEN_DATATYPE = 16; const unsigned short NMTOKENS_DATATYPE = 17; const unsigned short BOOLEAN_DATATYPE = 100; const unsigned short FLOAT_DATATYPE = 101; const unsigned short DOUBLE_DATATYPE = 102; const unsigned short DECIMAL_DATATYPE = 103; const unsigned short HEXBINARY_DATATYPE = 104; const unsigned short BASE64BINARY_DATATYPE = 105; const unsigned short ANYURI_DATATYPE = 106; const unsigned short QNAME_DATATYPE = 107; const unsigned short DURATION_DATATYPE = 108; const unsigned short DATETIME_DATATYPE = 109; const unsigned short DATE_DATATYPE = 110; const unsigned short TIME_DATATYPE = 111; const unsigned short GYEARMONTH_DATATYPE = 112; const unsigned short GYEAR_DATATYPE = 113; const unsigned short GMONTHDAY_DATATYPE = 114; const unsigned short GDAY_DATATYPE = 115; const unsigned short GMONTH_DATATYPE = 116; const unsigned short INTEGER = 117; const unsigned short NAME_DATATYPE = 200; const unsigned short NCNAME_DATATYPE = 201; const unsigned short NORMALIZEDSTRING_DATATYPE = 202; const unsigned short TOKEN_DATATYPE = 203; const unsigned short LANGUAGE_DATATYPE = 204; const unsigned short NONPOSITIVEINTEGER_DATATYPE = 205; const unsigned short NEGATIVEINTEGER_DATATYPE = 206; const unsigned short LONG_DATATYPE = 207; const unsigned short INT_DATATYPE = 208; const unsigned short SHORT_DATATYPE = 209; const unsigned short BYTE_DATATYPE = 210; const unsigned short NONNEGATIVEINTEGER_DATATYPE = 211; const unsigned short UNSIGNEDLONG_DATATYPE = 212; const unsigned short UNSIGNEDINT_DATATYPE = 213; const unsigned short UNSIGNEDSHORT_DATATYPE = 214; const unsigned short UNSIGNEDBYTE_DATATYPE = 215; const unsigned short POSITIVEINTEGER_DATATYPE = 216; const unsigned short OTHER_SIMPLE_DATATYPE = 1000; const unsigned short COMPLEX_DATATYPE = 1001; }; interface ASElementDeclaration : ASObject { // CONTENT_MODEL_TYPES const unsigned short EMPTY_CONTENTTYPE = 1; const unsigned short ANY_CONTENTTYPE = 2; const unsigned short MIXED_CONTENTTYPE = 3; const unsigned short ELEMENTS_CONTENTTYPE = 4; attribute boolean strictMixedContent; attribute ASDataType elementType; attribute boolean isPCDataOnly; attribute unsigned short contentType; attribute DOMString systemId; attribute ASContentModel asCM; attribute ASNamedObjectMap ASAttributeDecls; void addASAttributeDecl(in ASAttributeDeclaration attributeDecl); ASAttributeDeclaration removeASAttributeDecl(in ASAttributeDeclaration attributeDecl); }; interface ASContentModel : ASObject { const unsigned long AS_UNBOUNDED = MAX_VALUE; // ASContentModelType const unsigned short AS_SEQUENCE = 0; const unsigned short AS_CHOICE = 1; const unsigned short AS_ALL = 2; const unsigned short AS_NONE = 3; attribute unsigned short listOperator; attribute unsigned long minOccurs; attribute unsigned long maxOccurs; attribute ASObjectList subModels; void removesubModel(in ASObject oldNode); void insertsubModel(in ASObject newNode) raises(DOMASException); unsigned long appendsubModel(in ASObject newNode) raises(DOMASException); }; interface ASAttributeDeclaration : ASObject { // VALUE_TYPES const unsigned short VALUE_NONE = 0; const unsigned short VALUE_DEFAULT = 1; const unsigned short VALUE_FIXED = 2; attribute ASDataType dataType; attribute DOMString dataValue; attribute DOMString enumAttr; attribute ASObjectList ownerElements; attribute unsigned short defaultType; }; interface ASEntityDeclaration : ASObject { // EntityType const unsigned short INTERNAL_ENTITY = 1; const unsigned short EXTERNAL_ENTITY = 2; attribute unsigned short entityType; attribute DOMString entityValue; attribute DOMString systemId; attribute DOMString publicId; }; interface ASNotationDeclaration : ASObject { attribute DOMString systemId; attribute DOMString publicId; }; interface DocumentAS { attribute ASModel activeASModel; attribute ASObjectList boundASModels; ASModel getInternalAS(); void setInternalAS(in ASModel as); void addAS(in ASModel as); void removeAS(in ASModel as); ASElementDeclaration getElementDeclaration() raises(dom::DOMException); void validate() raises(DOMASException); }; interface DOMImplementationAS { ASModel createAS(in boolean isNamespaceAware); DOMASBuilder createDOMASBuilder(); DOMASWriter createDOMASWriter(); }; interface NodeEditAS { // ASCheckType const unsigned short WF_CHECK = 1; const unsigned short NS_WF_CHECK = 2; const unsigned short PARTIAL_VALIDITY_CHECK = 3; const unsigned short STRICT_VALIDITY_CHECK = 4; boolean canInsertBefore(in Node newChild, in Node refChild); boolean canRemoveChild(in Node oldChild); boolean canReplaceChild(in Node newChild, in Node oldChild); boolean canAppendChild(in Node newChild); boolean isNodeValid(in boolean deep, in unsigned short wFValidityCheckLevel) raises(DOMASException); }; interface ElementEditAS : NodeEditAS { readonly attribute NodeList definedElementTypes; unsigned short contentType(); boolean canSetAttribute(in DOMString attrname, in DOMString attrval); boolean canSetAttributeNode(in Attr attrNode); boolean canSetAttributeNS(in DOMString name, in DOMString attrval, in DOMString namespaceURI); boolean canRemoveAttribute(in DOMString attrname); boolean canRemoveAttributeNS(in DOMString attrname, in DOMString namespaceURI); boolean canRemoveAttributeNode(in Node attrNode); NodeList getChildElements(); NodeList getParentElements(); NodeList getAttributeList(); boolean isElementDefined(in DOMString elemTypeName); boolean isElementDefinedNS(in DOMString elemTypeName, in DOMString namespaceURI, in DOMString name); }; interface CharacterDataEditAS : NodeEditAS { readonly attribute boolean isWhitespaceOnly; boolean canSetData(in unsigned long offset, in unsigned long count); boolean canAppendData(in DOMString arg); boolean canReplaceData(in unsigned long offset, in unsigned long count, in DOMString arg); boolean canInsertData(in unsigned long offset, in DOMString arg); boolean canDeleteData(in unsigned long offset, in unsigned long count); }; interface ASModel : ASObject { readonly attribute boolean isNamespaceAware; readonly attribute unsigned short usageLocation; attribute DOMString asLocation; attribute DOMString asHint; readonly attribute ASNamedObjectMap elementDeclarations; readonly attribute ASNamedObjectMap attributeDeclarations; readonly attribute ASNamedObjectMap notationDeclarations; readonly attribute ASNamedObjectMap entityDeclarations; readonly attribute ASNamedObjectMap contentModelDeclarations; void setASModel(in ASModel abstractSchema); ASObjectList getASModels(); void removeAS(in ASModel as); boolean validate(); ASElementDeclaration createASElementDeclaration(in DOMString namespaceURI, in DOMString name) raises(dom::DOMException); ASAttributeDeclaration createASAttributeDeclaration(in DOMString namespaceURI, in DOMString name) raises(dom::DOMException); ASNotationDeclaration createASNotationDeclaration(in DOMString namespaceURI, in DOMString name, in DOMString systemId, in DOMString publicId) raises(dom::DOMException); ASEntityDeclaration createASEntityDeclaration(in DOMString name) raises(dom::DOMException); ASContentModel createASContentModel(in unsigned long minOccurs, in unsigned long maxOccurs, in unsigned short operator) raises(DOMASException); }; interface DocumentEditAS : NodeEditAS { attribute boolean continuousValidityChecking; }; interface DOMASBuilder : ls::DOMBuilder { attribute ASModel abstractSchema; ASModel parseASURI(in DOMString uri) raises(DOMASException, dom::DOMSystemException); ASModel parseASInputSource(in ls::DOMInputSource is) raises(DOMASException, dom::DOMSystemException); }; interface DOMASWriter : ls::DOMWriter { void writeASModel(in DOMOutputStream destination, in ASModel model) raises(dom::DOMSystemException); }; }; #endif // _AS_IDL_
// File: ls.idl #ifndef _LS_IDL_ #define _LS_IDL_ #include "dom.idl" #include "events.idl" #include "traversal.idl" #pragma prefix "dom.w3c.org" module ls { typedef dom::DOMErrorHandler DOMErrorHandler; typedef dom::DOMString DOMString; typedef dom::Node Node; typedef dom::Document Document; typedef dom::DOMOutputStream DOMOutputStream; typedef dom::DOMReader DOMReader; typedef dom::DOMError DOMError; interface DOMBuilder; interface DOMWriter; interface DOMInputSource; interface DOMEntityResolver; interface DOMBuilderFilter; interface DOMImplementationLS { // DOMIMplementationLSMode const unsigned short MODE_SYNCHRONOUS = 1; const unsigned short MODE_ASYNCHRONOUS = 2; DOMBuilder createDOMBuilder(in unsigned short mode) raises(dom::DOMException); DOMWriter createDOMWriter(); DOMInputSource createDOMInputSource(); }; interface DOMBuilder { attribute DOMEntityResolver entityResolver; attribute DOMErrorHandler errorHandler; attribute DOMBuilderFilter filter; void setFeature(in DOMString name, in boolean state) raises(dom::DOMException); boolean canSetFeature(in DOMString name, in boolean state); boolean getFeature(in DOMString name) raises(dom::DOMException); Document parseURI(in DOMString uri) raises(dom::DOMSystemException); Document parse(in DOMInputSource is) raises(dom::DOMSystemException); // ACTION_TYPES const unsigned short ACTION_REPLACE = 1; const unsigned short ACTION_APPEND = 2; const unsigned short ACTION_INSERT_AFTER = 3; const unsigned short ACTION_INSERT_BEFORE = 4; void parseWithContext(in DOMInputSource is, in Node cnode, in unsigned short action) raises(dom::DOMException); }; interface DOMWriter { void setFeature(in DOMString name, in boolean state) raises(dom::DOMException); boolean canSetFeature(in DOMString name, in boolean state); boolean getFeature(in DOMString name) raises(dom::DOMException); attribute DOMString encoding; readonly attribute DOMString lastEncoding; attribute DOMString newLine; attribute DOMErrorHandler errorHandler; boolean writeNode(in DOMOutputStream destination, in Node wnode) raises(dom::DOMSystemException); DOMString writeToString(in Node wnode) raises(dom::DOMException); }; interface DOMInputSource { attribute DOMInputSource byteStream; attribute DOMReader characterStream; attribute DOMString stringData; attribute DOMString encoding; attribute DOMString publicId; attribute DOMString systemId; attribute DOMString baseURI; }; interface DOMEntityResolver { DOMInputSource resolveEntity(in DOMString publicId, in DOMString systemId, in DOMString baseURI) raises(dom::DOMSystemException); }; interface DOMBuilderFilter { unsigned long startNode(in Node snode); unsigned long endNode(in Node enode); readonly attribute unsigned long whatToShow; }; interface DocumentLS { attribute boolean async; void abort(); boolean load(in DOMString uri); boolean loadXML(in DOMString source); DOMString saveXML(in Node snode) raises(dom::DOMException); }; interface LSLoadEvent : events::Event { readonly attribute Document newDocument; readonly attribute DOMInputSource inputSource; }; interface LSProgressEvent : events::Event { readonly attribute DOMInputSource inputSource; readonly attribute unsigned long position; readonly attribute unsigned long totalSize; }; interface DOMWriterFilter : traversal::NodeFilter { readonly attribute unsigned long whatToShow; }; interface ParseErrorEvent : events::Event { readonly attribute DOMError error; }; }; #endif // _LS_IDL_
This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Abstract Schemas and Load and Save.
The Java files are also available as http://www.w3.org/TR/2001/WD-DOM-Level-3-ASLS-20011025/java-binding.zip
package org.w3c.dom.as; public class DOMASException extends RuntimeException { public DOMASException(short code, String message) { super(message); this.code = code; } public short code; // ASExceptionCode public static final short DUPLICATE_NAME_ERR = 1; public static final short TYPE_ERR = 2; public static final short NO_AS_AVAILABLE = 3; public static final short WRONG_MIME_TYPE_ERR = 4; }
package org.w3c.dom.as; import org.w3c.dom.DOMException; public interface ASModel extends ASObject { public boolean getIsNamespaceAware(); public short getUsageLocation(); public String getAsLocation(); public void setAsLocation(String asLocation); public String getAsHint(); public void setAsHint(String asHint); public ASNamedObjectMap getElementDeclarations(); public ASNamedObjectMap getAttributeDeclarations(); public ASNamedObjectMap getNotationDeclarations(); public ASNamedObjectMap getEntityDeclarations(); public ASNamedObjectMap getContentModelDeclarations(); public void setASModel(ASModel abstractSchema); public ASObjectList getASModels(); public void removeAS(ASModel as); public boolean validate(); public ASElementDeclaration createASElementDeclaration(String namespaceURI, String name) throws DOMException; public ASAttributeDeclaration createASAttributeDeclaration(String namespaceURI, String name) throws DOMException; public ASNotationDeclaration createASNotationDeclaration(String namespaceURI, String name, String systemId, String publicId) throws DOMException; public ASEntityDeclaration createASEntityDeclaration(String name) throws DOMException; public ASContentModel createASContentModel(int minOccurs, int maxOccurs, short operator) throws DOMASException; }
package org.w3c.dom.as; public interface ASObject { // ASObjectType public static final short AS_ELEMENT_DECLARATION = 1; public static final short AS_ATTRIBUTE_DECLARATION = 2; public static final short AS_NOTATION_DECLARATION = 3; public static final short AS_ENTITY_DECLARATION = 4; public static final short AS_CONTENTMODEL = 5; public static final short AS_MODEL = 6; public short getAsNodeType(); public ASModel getOwnerASModel(); public void setOwnerASModel(ASModel ownerASModel); public String getNodeName(); public void setNodeName(String nodeName); public String getPrefix(); public void setPrefix(String prefix); public String getLocalName(); public void setLocalName(String localName); public String getNamespaceURI(); public void setNamespaceURI(String namespaceURI); public ASObject cloneASObject(boolean deep); }
package org.w3c.dom.as; public interface ASObjectList { public int getLength(); public ASObject item(int index); }
package org.w3c.dom.as; import org.w3c.dom.DOMException; public interface ASNamedObjectMap { public int getLength(); public ASObject getNamedItem(String name); public ASObject getNamedItemNS(String namespaceURI, String localName); public ASObject item(int index); public ASObject removeNamedItem(String name) throws DOMException; public ASObject removeNamedItemNS(String namespaceURI, String localName) throws DOMException; public ASObject setNamedItem(ASObject newASObject) throws DOMException; public ASObject setNamedItemNS(ASObject newASObject) throws DOMException; }
package org.w3c.dom.as; public interface ASDataType { public short getDataType(); // DATA_TYPES public static final short STRING_DATATYPE = 1; public static final short NOTATION_DATATYPE = 10; public static final short ID_DATATYPE = 11; public static final short IDREF_DATATYPE = 12; public static final short IDREFS_DATATYPE = 13; public static final short ENTITY_DATATYPE = 14; public static final short ENTITIES_DATATYPE = 15; public static final short NMTOKEN_DATATYPE = 16; public static final short NMTOKENS_DATATYPE = 17; public static final short BOOLEAN_DATATYPE = 100; public static final short FLOAT_DATATYPE = 101; public static final short DOUBLE_DATATYPE = 102; public static final short DECIMAL_DATATYPE = 103; public static final short HEXBINARY_DATATYPE = 104; public static final short BASE64BINARY_DATATYPE = 105; public static final short ANYURI_DATATYPE = 106; public static final short QNAME_DATATYPE = 107; public static final short DURATION_DATATYPE = 108; public static final short DATETIME_DATATYPE = 109; public static final short DATE_DATATYPE = 110; public static final short TIME_DATATYPE = 111; public static final short GYEARMONTH_DATATYPE = 112; public static final short GYEAR_DATATYPE = 113; public static final short GMONTHDAY_DATATYPE = 114; public static final short GDAY_DATATYPE = 115; public static final short GMONTH_DATATYPE = 116; public static final short INTEGER = 117; public static final short NAME_DATATYPE = 200; public static final short NCNAME_DATATYPE = 201; public static final short NORMALIZEDSTRING_DATATYPE = 202; public static final short TOKEN_DATATYPE = 203; public static final short LANGUAGE_DATATYPE = 204; public static final short NONPOSITIVEINTEGER_DATATYPE = 205; public static final short NEGATIVEINTEGER_DATATYPE = 206; public static final short LONG_DATATYPE = 207; public static final short INT_DATATYPE = 208; public static final short SHORT_DATATYPE = 209; public static final short BYTE_DATATYPE = 210; public static final short NONNEGATIVEINTEGER_DATATYPE = 211; public static final short UNSIGNEDLONG_DATATYPE = 212; public static final short UNSIGNEDINT_DATATYPE = 213; public static final short UNSIGNEDSHORT_DATATYPE = 214; public static final short UNSIGNEDBYTE_DATATYPE = 215; public static final short POSITIVEINTEGER_DATATYPE = 216; public static final short OTHER_SIMPLE_DATATYPE = 1000; public static final short COMPLEX_DATATYPE = 1001; }
package org.w3c.dom.as; public interface ASElementDeclaration extends ASObject { // CONTENT_MODEL_TYPES public static final short EMPTY_CONTENTTYPE = 1; public static final short ANY_CONTENTTYPE = 2; public static final short MIXED_CONTENTTYPE = 3; public static final short ELEMENTS_CONTENTTYPE = 4; public boolean getStrictMixedContent(); public void setStrictMixedContent(boolean strictMixedContent); public ASDataType getElementType(); public void setElementType(ASDataType elementType); public boolean getIsPCDataOnly(); public void setIsPCDataOnly(boolean isPCDataOnly); public short getContentType(); public void setContentType(short contentType); public String getSystemId(); public void setSystemId(String systemId); public ASContentModel getAsCM(); public void setAsCM(ASContentModel asCM); public ASNamedObjectMap getASAttributeDecls(); public void setASAttributeDecls(ASNamedObjectMap ASAttributeDecls); public void addASAttributeDecl(ASAttributeDeclaration attributeDecl); public ASAttributeDeclaration removeASAttributeDecl(ASAttributeDeclaration attributeDecl); }
package org.w3c.dom.as; public interface ASContentModel extends ASObject { public static final int AS_UNBOUNDED = MAX_VALUE; // ASContentModelType public static final short AS_SEQUENCE = 0; public static final short AS_CHOICE = 1; public static final short AS_ALL = 2; public static final short AS_NONE = 3; public short getListOperator(); public void setListOperator(short listOperator); public int getMinOccurs(); public void setMinOccurs(int minOccurs); public int getMaxOccurs(); public void setMaxOccurs(int maxOccurs); public ASObjectList getSubModels(); public void setSubModels(ASObjectList subModels); public void removesubModel(ASObject oldNode); public void insertsubModel(ASObject newNode) throws DOMASException; public int appendsubModel(ASObject newNode) throws DOMASException; }
package org.w3c.dom.as; public interface ASAttributeDeclaration extends ASObject { // VALUE_TYPES public static final short VALUE_NONE = 0; public static final short VALUE_DEFAULT = 1; public static final short VALUE_FIXED = 2; public ASDataType getDataType(); public void setDataType(ASDataType dataType); public String getDataValue(); public void setDataValue(String dataValue); public String getEnumAttr(); public void setEnumAttr(String enumAttr); public ASObjectList getOwnerElements(); public void setOwnerElements(ASObjectList ownerElements); public short getDefaultType(); public void setDefaultType(short defaultType); }
package org.w3c.dom.as; public interface ASEntityDeclaration extends ASObject { // EntityType public static final short INTERNAL_ENTITY = 1; public static final short EXTERNAL_ENTITY = 2; public short getEntityType(); public void setEntityType(short entityType); public String getEntityValue(); public void setEntityValue(String entityValue); public String getSystemId(); public void setSystemId(String systemId); public String getPublicId(); public void setPublicId(String publicId); }
package org.w3c.dom.as; public interface ASNotationDeclaration extends ASObject { public String getSystemId(); public void setSystemId(String systemId); public String getPublicId(); public void setPublicId(String publicId); }
package org.w3c.dom.as; import org.w3c.dom.DOMException; public interface DocumentAS { public ASModel getActiveASModel(); public void setActiveASModel(ASModel activeASModel); public ASObjectList getBoundASModels(); public void setBoundASModels(ASObjectList boundASModels); public ASModel getInternalAS(); public void setInternalAS(ASModel as); public void addAS(ASModel as); public void removeAS(ASModel as); public ASElementDeclaration getElementDeclaration() throws DOMException; public void validate() throws DOMASException; }
package org.w3c.dom.as; public interface DOMImplementationAS { public ASModel createAS(boolean isNamespaceAware); public DOMASBuilder createDOMASBuilder(); public DOMASWriter createDOMASWriter(); }
package org.w3c.dom.as; public interface DocumentEditAS extends NodeEditAS { public boolean getContinuousValidityChecking(); public void setContinuousValidityChecking(boolean continuousValidityChecking); }
package org.w3c.dom.as; import org.w3c.dom.Node; public interface NodeEditAS { // ASCheckType public static final short WF_CHECK = 1; public static final short NS_WF_CHECK = 2; public static final short PARTIAL_VALIDITY_CHECK = 3; public static final short STRICT_VALIDITY_CHECK = 4; public boolean canInsertBefore(Node newChild, Node refChild); public boolean canRemoveChild(Node oldChild); public boolean canReplaceChild(Node newChild, Node oldChild); public boolean canAppendChild(Node newChild); public boolean isNodeValid(boolean deep, short wFValidityCheckLevel) throws DOMASException; }
package org.w3c.dom.as; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Attr; public interface ElementEditAS extends NodeEditAS { public NodeList getDefinedElementTypes(); public short contentType(); public boolean canSetAttribute(String attrname, String attrval); public boolean canSetAttributeNode(Attr attrNode); public boolean canSetAttributeNS(String name, String attrval, String namespaceURI); public boolean canRemoveAttribute(String attrname); public boolean canRemoveAttributeNS(String attrname, String namespaceURI); public boolean canRemoveAttributeNode(Node attrNode); public NodeList getChildElements(); public NodeList getParentElements(); public NodeList getAttributeList(); public boolean isElementDefined(String elemTypeName); public boolean isElementDefinedNS(String elemTypeName, String namespaceURI, String name); }
package org.w3c.dom.as; public interface CharacterDataEditAS extends NodeEditAS { public boolean getIsWhitespaceOnly(); public boolean canSetData(int offset, int count); public boolean canAppendData(String arg); public boolean canReplaceData(int offset, int count, String arg); public boolean canInsertData(int offset, String arg); public boolean canDeleteData(int offset, int count); }
package org.w3c.dom.as; import org.w3c.dom.ls.DOMInputSource; import org.w3c.dom.ls.DOMBuilder; public interface DOMASBuilder extends DOMBuilder { public ASModel getAbstractSchema(); public void setAbstractSchema(ASModel abstractSchema); public ASModel parseASURI(String uri) throws DOMASException, Exception; public ASModel parseASInputSource(DOMInputSource is) throws DOMASException, Exception; }
package org.w3c.dom.as; import org.w3c.dom.ls.DOMWriter; public interface DOMASWriter extends DOMWriter { public void writeASModel(java.io.OutputStream destination, ASModel model) throws Exception; }
package org.w3c.dom.ls; import org.w3c.dom.DOMException; public interface DOMImplementationLS { // DOMIMplementationLSMode public static final short MODE_SYNCHRONOUS = 1; public static final short MODE_ASYNCHRONOUS = 2; public DOMBuilder createDOMBuilder(short mode) throws DOMException; public DOMWriter createDOMWriter(); public DOMInputSource createDOMInputSource(); }
package org.w3c.dom.ls; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.DOMException; import org.w3c.dom.DOMErrorHandler; public interface DOMBuilder { public DOMEntityResolver getEntityResolver(); public void setEntityResolver(DOMEntityResolver entityResolver); public DOMErrorHandler getErrorHandler(); public void setErrorHandler(DOMErrorHandler errorHandler); public DOMBuilderFilter getFilter(); public void setFilter(DOMBuilderFilter filter); public void setFeature(String name, boolean state) throws DOMException; public boolean canSetFeature(String name, boolean state); public boolean getFeature(String name) throws DOMException; public Document parseURI(String uri) throws Exception; public Document parse(DOMInputSource is) throws Exception; // ACTION_TYPES public static final short ACTION_REPLACE = 1; public static final short ACTION_APPEND = 2; public static final short ACTION_INSERT_AFTER = 3; public static final short ACTION_INSERT_BEFORE = 4; public void parseWithContext(DOMInputSource is, Node cnode, short action) throws DOMException; }
package org.w3c.dom.ls; import org.w3c.dom.Node; import org.w3c.dom.DOMException; import org.w3c.dom.DOMErrorHandler; public interface DOMWriter { public void setFeature(String name, boolean state) throws DOMException; public boolean canSetFeature(String name, boolean state); public boolean getFeature(String name) throws DOMException; public String getEncoding(); public void setEncoding(String encoding); public String getLastEncoding(); public String getNewLine(); public void setNewLine(String newLine); public DOMErrorHandler getErrorHandler(); public void setErrorHandler(DOMErrorHandler errorHandler); public boolean writeNode(java.io.OutputStream destination, Node wnode) throws Exception; public String writeToString(Node wnode) throws DOMException; }
package org.w3c.dom.ls; public interface DOMInputSource { public DOMInputSource getByteStream(); public void setByteStream(DOMInputSource byteStream); public java.io.Reader getCharacterStream(); public void setCharacterStream(java.io.Reader characterStream); public String getStringData(); public void setStringData(String stringData); public String getEncoding(); public void setEncoding(String encoding); public String getPublicId(); public void setPublicId(String publicId); public String getSystemId(); public void setSystemId(String systemId); public String getBaseURI(); public void setBaseURI(String baseURI); }
package org.w3c.dom.ls; import org.w3c.dom.Document; import org.w3c.dom.events.Event; public interface LSLoadEvent extends Event { public Document getNewDocument(); public DOMInputSource getInputSource(); }
package org.w3c.dom.ls; import org.w3c.dom.events.Event; public interface LSProgressEvent extends Event { public DOMInputSource getInputSource(); public int getPosition(); public int getTotalSize(); }
package org.w3c.dom.ls; public interface DOMEntityResolver { public DOMInputSource resolveEntity(String publicId, String systemId, String baseURI) throws Exception; }
package org.w3c.dom.ls; import org.w3c.dom.Node; public interface DOMBuilderFilter { public int startNode(Node snode); public int endNode(Node enode); public int getWhatToShow(); }
package org.w3c.dom.ls; import org.w3c.dom.traversal.NodeFilter; public interface DOMWriterFilter extends NodeFilter { public int getWhatToShow(); }
package org.w3c.dom.ls; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface DocumentLS { public boolean getAsync(); public void setAsync(boolean async); public void abort(); public boolean load(String uri); public boolean loadXML(String source); public String saveXML(Node snode) throws DOMException; }
package org.w3c.dom.ls; import org.w3c.dom.events.Event; import org.w3c.dom.DOMError; public interface ParseErrorEvent extends Event { public DOMError getError(); }
This appendix contains the complete ECMAScript [ECMAScript] binding for the Level 3 Document Object Model Abstract Schemas and Load and Save definitions.
Many people contributed to the DOM specifications (Level 1, 2 or 3), including members of the DOM Working Group and the DOM Interest Group. We especially thank the following:
Andrew Watson (Object Management Group), Andy Heninger (IBM), Angel Diaz (IBM), Arnaud Le Hors (W3C and IBM), Ashok Malhotra (IBM and Microsoft), Ben Chang (Oracle), Bill Smith (Sun), Bill Shea (Merrill Lynch), Bob Sutor (IBM), Chris Lovett (Microsoft), Chris Wilson (Microsoft), David Brownell (Sun), David Ezell (Hewlett Packard Company), David Singer (IBM), Dimitris Dimitriadis (Improve AB), Don Park (invited), Elena Litani (IBM), Eric Vasilik (Microsoft), Gavin Nicol (INSO), Ian Jacobs (W3C), James Clark (invited), James Davidson (Sun), Jared Sorensen (Novell), Jeroen van Rotterdam (X-Hive Corporation), Joe Kesselman (IBM), Joe Lapp (webMethods), Joe Marini (Macromedia), Johnny Stenback (Netscape/AOL), Jon Ferraiolo (Adobe), Jonathan Marsh (Microsoft), Jonathan Robie (Texcel Research and Software AG), Kim Adamson-Sharpe (SoftQuad Software Inc.), Lauren Wood (SoftQuad Software Inc., former chair), Laurence Cable (Sun), Mark Davis (IBM), Mark Scardina (Oracle), Martin Dürst (W3C), Mary Brady (NIST), Mick Goulish (Software AG), Mike Champion (Arbortext and Software AG), Miles Sabin (Cromwell Media), Patti Lutsky (Arbortext), Paul Grosso (Arbortext), Peter Sharpe (SoftQuad Software Inc.), Phil Karlton (Netscape), Philippe Le Hégaret (W3C, W3C team contact and Chair), Ramesh Lekshmynarayanan (Merrill Lynch), Ray Whitmer (iMall, Excite@Home, and Netscape/AOL), Rezaur Rahman (Intel), Rich Rollman (Microsoft), Rick Gessner (Netscape), Rick Jelliffe (invited), Rob Relyea (Microsoft), Scott Isaacs (Microsoft), Sharon Adler (INSO), Steve Byrne (JavaSoft), Tim Bray (invited), Tim Yu (Oracle), Tom Pixley (Netscape/AOL), Vidur Apparao (Netscape), Vinod Anupam (Lucent).
Thanks to all those who have helped to improve this specification by sending suggestions and corrections (Please, keep bugging us with your issues!).
This specification was written in XML. The HTML, OMG IDL, Java and ECMAScript bindings were all produced automatically.
Thanks to Joe English, author of cost, which was used as the basis for producing DOM Level 1. Thanks also to Gavin Nicol, who wrote the scripts which run on top of cost. Arnaud Le Hors and Philippe Le Hégaret maintained the scripts.
After DOM Level 1, we used Xerces as the basis DOM implementation and wish to thank the authors. Philippe Le Hégaret and Arnaud Le Hors wrote the Java programs which are the DOM application.
Thanks also to Jan Kärrman, author of html2ps, which we use in creating the PostScript version of the specification.
Several of the following term definitions have been borrowed or modified from similar definitions in other W3C or standards documents. See the links within the definitions for more information.
DOMString
. This indicates that
indexing on a DOMString
occurs in units of 16 bits.
This must not be misunderstood to mean that a
DOMString
can store arbitrary 16-bit units. A
DOMString
is a character string encoded in UTF-16;
this means that the restrictions of UTF-16 as well as the other
relevant restrictions on character strings must be maintained. A
single character, for example in the form of a numeric character
reference, may correspond to one or two 16-bit units.Document
.
This element node is a child of the Document
node. See
Well-Formed
XML Documents in XML [XML].For the latest version of any W3C specification please consult the list of W3C Technical Reports available at http://www.w3.org/TR.