Stylus Studio XML Editor

Table of contents

Appendices

1.3 Document Editing Interfaces

Document Editing Interfaces

This section contains "Document Editing" methods as described in the DocumentEditVAL, NodeEditVAL, ElementEditVAL, and CharacterDataEditVAL interfaces. References to new [DOMCore] interfaces such as DOMStringList and NameList also exist. With the latter interface, if the schema is a DTD, the element information item names are simply local names; if the schema is a W3C XML schema, the names are qualified names, which may contain namespace prefixes.

This interface extends the NodeEditVAL interface with additional methods for document editing. An object implementing this interface must also implement the Document interface.

An attribute specifying whether the validity of the document is continuously enforced. When the attribute is set to true, the implementation may raise certain exceptions, depending on the situation (see the following). This attribute is false by default.

NOT_SUPPORTED_ERR: Raised if the implementation does not support setting this attribute to true.

NO_SCHEMA_AVAILABLE_ERR: Raised if this attribute is set to true and a schema is unavailable.

VALIDATION_ERR: Raised if an operation makes this document not compliant with the VAL_INCOMPLETE validity type or the document is invalid, and this attribute is set to true.

This allows the setting of the error handler, as described in the [DOMCore] DOMConfiguration interface. An object implementing this DocumentEditVAL interface and the [DOMCore] Document interface, which also has a domConfig attribute, needs to only implement this attribute once.

Returns list of all element information item names of global declaration, belonging to the specified namespace.

namespaceURI of namespace. For DTDs, this is null.

List of all element information item names belonging to the specified namespace or null if no schema is available.

Validates the document against the schema, e.g., a DTD or an W3C XML schema or another. Any attempt to modify any part of the document while validating results in implementation-dependent behavior. In addition, the validation operation itself cannot modify the document, e.g., for default attributes. This method makes use of the error handler, as described in the [DOMCore] DOMConfiguration interface, with all errors being SEVERITY_ERROR as defined in the DOMError interface.

A validation state constant.

This interface is similar to the [DOMCore] Node interface, with methods for guided document editing.

An integer indicating the validation type. Other specifications can define stricter validation types/constants by extending the NodeEditVAL interface.

Check if the node is well-formed.

Check if the node is namespace well-formed.

Check if the node's immediate children are those expected by the content model. This node's trailing required children could be missing. It includes VAL_NS_WF.

Check if the node's entire subtree are those expected by the content model. It includes VAL_NS_WF.

An integer indicating the validation state, or whether the operation can or cannot be done.

True if the node is valid with regards to the operation, or if the operation can be done.

False if the node is invalid with regards to the operation, or if the operation cannot be done.

The validity of the node is unknown.

The default value specified in an attribute or an element declaration or null if unspecified. If the schema is a W3C XML schema, this is the canonical lexical representation of the default value.

A DOMStringList, as described in [DOMCore], of distinct values for an attribute or an element declaration or null if unspecified. If the schema is a W3C XML schema, this is a list of strings which are lexical representations corresponding to the values in the [value] property of the enumeration component for the type of the attribute or element. It is recommended that the canonical lexical representations of the values be used.

Determines whether the Node.insertBefore operation would make this document not compliant with the VAL_INCOMPLETE validity type.

Node to be inserted.

Reference Node.

A validation state constant.

Determines whether the Node.removeChild operation would make this document not compliant with the VAL_INCOMPLETE validity type.

Node to be removed.

A validation state constant.

Determines whether the Node.replaceChild operation would make this document not compliant with the VAL_INCOMPLETE validity type.

New Node.

Node to be replaced.

A validation state constant.

Determines whether the Node.appendChild operation would make this document not compliant with the VAL_INCOMPLETE validity type.

Node to be appended.

A validation state constant.

Determines if the node is valid relative to the validation type specified in valType. This operation doesn't normalize before checking if it is valid. To do so, one would need to explicitly call a normalize method. The difference between this method and the DocumentEditVAL.validateDocument method is that the latter method only checks to determine whether the entire document is valid.

Flag to indicate the validation type checking to be done.

A validation state constant.

This interface extends the NodeEditVAL interface with additional methods for guided document editing. An object implementing this interface must also implement the Element interface.

Level-3-VAL-Wildcards This interface also has attributes that are a NameList of elements or attributes which can appear in the specified context. Some schema languages, i.e., W3C XML schema, define wildcards which provide for validation of attribute and element information items dependent on their namespace names but independent of their local names.

To expose wildcards, the NameList returns the values that represent the namespace constraint:

  • {namespaceURI, name} is {null, ##any} if any;

  • {namespaceURI, name} is {namespace_a, ##other} if not and a namespace name (namespace_a);

  • {namespaceURI, name} is {null, ##other} if not and absent;

  • Pairs of {namespaceURI, name} with values {a_namespaceURI | null, null} if a set whose members are either namespace names or absent.

An integer indicating the content type of an element.

The content model does not allow any content. If the schema is a W3C XML schema, this corresponds to the empty content type; and if the schema is a DTD, this corresponds to the EMPTY content model.

The content model contains unordered child information item(s), i.e., element, processing instruction, unexpanded entity reference, character, and comment information items as defined in the XML Information Set. If the schema is a DTD, this corresponds to the ANY content model.

The content model contains a sequence of ordered element information items optionally interspersed with character data. If the schema is a W3C XML schema, this corresponds to the mixed content type.

The content model contains a sequence of element information items optionally separated by whitespace. If the schema is a DTD, this is the element content content model; and if the schema is a W3C XML schema, this is the element-only content type.

The content model contains character information items. If the schema is a W3C XML schema, then the element has a content type of VAL_SIMPLE_CONTENTTYPE if the type of the element is a simple type definition, or the type of the element is a complexType whose {content type} is a simple type definition.

A NameList, as described in [DOMCore], of all possible element information items or wildcards that can appear as children of this element, or null if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.

A NameList, as described in [DOMCore], of all possible element information items or wildcards that can appear as a first child of this element, or null if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.

A NameList, as described in [DOMCore], of all possible element information items that can appear as a parent this element, or null if this element has no context or schema.

A NameList, as described in [DOMCore], of all element information items or wildcards that can be inserted as a next sibling of this element, or null if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.

A NameList, as described in [DOMCore], of all element information items or wildcards that can be inserted as a previous sibling of this element, or null if this element has no context or schema.

A NameList, as described in [DOMCore], of all possible attribute information items or wildcards that can appear as attributes of this element, or null if this element has no context or schema. Duplicate pairs of {namespaceURI, name} are eliminated.

A NameList, as described in [DOMCore], of required attribute information items that must appear on this element, or null if this element has no context or schema.

The content type of an element as defined above.

Determines if the text content of this node and its descendants can be set to the string passed in.

Possible text content string.

A validation state constant.

Determines if the value for specified attribute can be set.

Name of attribute.

Value to be assigned to the attribute.

A validation state constant.

Determines if an attribute node can be added.

Node in which the attribute can possibly be set.

A validation state constant.

Determines if the attribute with given namespace and qualified name can be created if not already present in the attribute list of the element. If the attribute with the same qualified name and namespaceURI is already present in the element's attribute list, it tests whether the value of the attribute and its prefix can be set to the new value.

namespaceURI of namespace.

Qualified name of attribute.

Value to be assigned to the attribute.

A validation state constant.

Verifies if an attribute by the given name can be removed.

Name of attribute.

A validation state constant.

Verifies if an attribute by the given local name and namespace can be removed.

The namespace URI of the attribute to remove.

Local name of the attribute to be removed.

A validation state constant.

Determines if an attribute node can be removed.

The Attr node to remove from the attribute list.

A validation state constant.

Determines if name is defined in the schema. This only applies to global declarations. This method is for non-namespace aware schemas.

Name of element.

A validation state constant.

Determines if name in this namespace is defined in the current context. Thus not only does this apply to global declarations. but depending on the content, this may also apply to local definitions. This method is for namespace aware schemas.

namespaceURI of namespace.

Name of element.

A validation state constant.

This interface extends the NodeEditVAL interface with additional methods for document editing. An object implementing this interface must also implement CharacterData interface. When validating CharacterData nodes, the NodeEditVAL.nodeValidity operation must find the nearest parent node in order to do this; if no parent node is found, VAL_UNKNOWN is returned. In addition, when VAL_INCOMPLETE is passed in as an argument to the NodeEditVAL.nodeValidity operation to operate on such nodes, the operation considers all the text and not just some of it.

Determines if character data is only whitespace.

A validation state constant.

Determines if character data can be set.

Argument to be set.

A validation state constant.

Determines if character data can be appended.

Data to be appended.

A validation state constant.

Determines if character data can be replaced.

Offset.

Replacement.

Argument to be set.

A validation state constant.

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.

Determines if character data can be inserted.

Offset.

Argument to be set.

A validation state constant.

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data.

Determines if character data can be deleted.

Offset.

Number of 16-bit units to delete.

A validation state constant.

INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in data, or if the specified count is negative.