|
|||||||||
Home >> All >> org >> apache >> xerces >> [ dom3 overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
org.apache.xerces.dom3
Interface DOMConfiguration

- public interface DOMConfiguration
The DOMConfiguration
interface represents the configuration
of a document and maintains a table of recognized parameters. Using the
configuration, it is possible to change
Document.normalizeDocument()
behavior, such as replacing the
CDATASection
nodes with Text
nodes or
specifying the type of the schema that must be used when the validation
of the Document
is requested. DOMConfiguration
objects are also used in [DOM Level 3 Load and Save]
in the DOMParser
and DOMSerializer
interfaces.
The parameter names used by the DOMConfiguration
object
are defined throughout the DOM Level 3 specifications. Names are
case-insensitives. To avoid possible conflicts, as a convention, names
referring to parameters defined outside the DOM specification should be
made unique. Because parameters are exposed as properties in the , names
are recommended to follow the section 5.16 Identifiers of [Unicode] with the addition of the character '-' (HYPHEN-MINUS) but it is not
enforced by the DOM implementation. DOM Level 3 Core Implementations are
required to recognize all parameters defined in this specification. Some
parameter values may also be required to be supported by the
implementation. Refer to the definition of the parameter to know if a
value must be supported or not.
Note: Parameters are similar to features and properties used in SAX2 [SAX].
The following list of parameters defined in the DOM:
-
"canonical-form"
-
true
- [optional]Canonicalize the document according to the rules specified in [Canonical XML].
Note that this is limited to what can be represented in the DOM. In
particular, there is no way to specify the order of the attributes in the
DOM.This forces the following parameters to
false
: "entities ", "normalize-characters", "cdata-sections".This forces the following parameters totrue
: "namespaces", "namespace-declarations", " well-formed", "element-content-whitespace".Other parameters are not changed unless explicitly specified in the description of the parameters. In addition, theDocumentType
node is removed from the tree if any and superfluous namespace declarations are removed from each element. Note that querying this parameter withgetParameter
cannot returntrue
unless it has been set totrue
and the parameters described above are appropriately set. false
- [required] (default)Do not canonicalize the document.
"cdata-sections"
-
-
true
- [required] (default)Keep
CDATASection
nodes in the document. false
- [required]Transform
CDATASection
nodes in the document intoText
nodes. The newText
node is then combined with any adjacentText
node.
-
-
"check-character-normalization"
-
true
- [optional] Check if the characters in the document are fully normalized according to the rules defined in [CharModel] supplemented by the definitions of relevant constructs from Section 2.13 of [XML 1.1].
-
false
- [required] (default)Do not check if characters are normalized.
"comments"
-
-
true
- [required] (default)Keep
Comment
nodes in the document. false
- [required]Discard
Comment
nodes in the document.
-
-
"datatype-normalization"
-
true
- [optional] Exposed schema-normalized values in the tree. Since this parameter
requires to have schema information, the "validate" parameter will also
be set to
true
. Having this parameter activated when "validate" isfalse
has no effect and no schema-normalization will happen.Note: Since the document contains the result of the XML 1.0 processing, this parameter does not apply to attribute value normalization as defined in section 3.3.3 of [XML 1.0] and is only meant for schema languages other than Document Type Definition (DTD).
-
false
- [required] (default) Do not perform schema normalization on the tree.
"entities"
-
-
true
- [required] (default)Keep
EntityReference
andEntity
nodes in the document. false
- [required] Remove all
EntityReference
andEntity
nodes from the document, putting the entity expansions directly in their place.Text
nodes are normalized, as defined inNode.normalize
. OnlyEntityReference
nodes to non-defined entities are kept in the document, with their associatedEntity
nodes if any.
-
"error-handler"
- [required] Contains a
DOMErrorHandler
object. If an error is encountered in the document, the implementation will call back theDOMErrorHandler
registered using this parameter. The implementation may provide a defaultDOMErrorHandler
object. When called,DOMError.relatedData
will contain the closest node to where the error occurred. If the implementation is unable to determine the node where the error occurs,DOMError.relatedData
will contain theDocument
node. Mutations to the document from within an error handler will result in implementation dependent behavior. "infoset"
-
-
true
- [required]Keep in the document the information defined in the XML Information Set [XML Information Set]
.This forces the following parameters to
false
: " validate-if-schema", "entities", "datatype-normalization", "cdata-sections ".This forces the following parameters totrue
: " namespace-declarations", "well-formed", "element-content-whitespace", " comments", "namespaces".Other parameters are not changed unless explicitly specified in the description of the parameters. Note that querying this parameter withgetParameter
returnstrue
only if the individual parameters specified above are appropriately set. false
- Setting
infoset
tofalse
has no effect.
-
"namespaces"
-
-
true
- [required] (default) Perform the namespace processing as defined in .
false
- [optional] Do not perform the namespace processing.
-
-
"namespace-declarations"
-
true
- [required] (default) Include namespace declaration attributes, specified or defaulted from the schema, in the document. See also the sections "Declaring Namespaces" in [XML Namespaces] and [XML Namespaces 1.1] .
false
- [required]Discard all namespace declaration attributes. The namespace prefixes (
Node.prefix
) are retained even if this parameter is set tofalse
.
"normalize-characters"
-
true
- [optional] Fully normalize the characters in the document according to the rules defined in [CharModel] supplemented by the definitions of relevant constructs from Section 2.13 of [XML 1.1].
-
false
- [required] (default)Do not perform character normalization.
"schema-location"
- [optional] Represent a
DOMString
object containing a list of URIs, separated by whitespaces (characters matching the nonterminal production S defined in section 2.3 [XML 1.0]), that represents the schemas against which validation should occur, i.e. the current schema. The types of schemas referenced in this list must match the type specified withschema-type
, otherwise the behavior of an implementation is undefined. The schemas specified using this property take precedence to the schema information specified in the document itself. For namespace aware schema, if a schema specified using this property and a schema specified in the document instance (i.e. using theschemaLocation
attribute) in a schema document (i.e. using schemaimport
mechanisms) share the sametargetNamespace
, the schema specified by the user using this property will be used. If two schemas specified using this property share the sametargetNamespace
or have no namespace, the behavior is implementation dependent. If no location has been provided, this parameter isnull
.Note: The
"schema-location"
parameter is ignored unless the "schema-type" parameter value is set. It is strongly recommended thatDocument.documentURI
will be set so that an implementation can successfully resolve any external entities referenced. -
"schema-type"
- [optional] Represent a
DOMString
object containing an absolute URI and representing the type of the schema language used to validate a document against. Note that no lexical checking is done on the absolute URI. If this parameter is not set, a default value may be provided by the implementation, based on the schema languages supported and on the schema language used at load time. If no value is provided, this parameter isnull
.Note: For XML Schema [XML Schema Part 1] , applications must use the value
"http://www.w3.org/2001/XMLSchema"
. For XML DTD [XML 1.0], applications must use the value"http://www.w3.org/TR/REC-xml"
. Other schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method. "split-cdata-sections"
-
-
true
- [required] (default)Split CDATA sections containing the CDATA section termination marker
']]>'. When a CDATA section is split a warning is issued with a
DOMError.type
equals to"cdata-sections-splitted"
andDOMError.relatedData
equals to the firstCDATASection
node in document order resulting from the split. -
false
- [required]Signal an error if a
CDATASection
contains an unrepresentable character.
-
"validate"
-
true
- [optional] Require the validation against a schema (i.e. XML schema, DTD, any
other type or representation of schema) of the document as it is being
normalized as defined by [XML 1.0]. If
validation errors are found, or no schema was found, the error handler is
notified. Schema-normalized values will not be exposed according to the
schema in used unless the parameter "datatype-normalization" is
true
. This parameter will reevaluate:- Attribute nodes with
Attr.specified
equals tofalse
, as specified in the description of theAttr
interface; - The value of the
attribute
Text.isElementContentWhitespace
for allText
nodes; - The value of the attribute
Attr.isId
for allAttr
nodes; - The attributes
Element.schemaTypeInfo
andAttr.schemaTypeInfo
.
Note: "validate-if-schema" and "validate" are mutually exclusive, setting one of them to
true
will set the other one tofalse
. Applications should also consider setting the parameter "well-formed" totrue
, which is the default for that option, when validating the document. - Attribute nodes with
false
- [required] (default) Do not accomplish schema processing, including the internal subset
processing. Note that validation might still happen if "
"validate-if-schema" is
true
.
-
"validate-if-schema"
-
true
- [optional]Enable validation only if a declaration for the document element can be
found in a schema (independently of where it is found, i.e. XML schema,
DTD, or any other type or representation of schema). If validation is
enabled, this parameter has the same behavior as the parameter "validate"
set to
true
.Note: "validate-if-schema" and "validate" are mutually exclusive, setting one of them to
true
will set the other one tofalse
. false
- [required] (default) No schema processing should be performed if the document has a schema,
including internal subset processing. Note that validation must still
happen if "validate" is
true
.
"well-formed"
-
-
true
- [required] (default) Check if all nodes are XML well formed according to the XML version in
use in
Document.xmlVersion
:- check if the attribute
Node.nodeName
contains invalid characters according to its node type and generate aDOMError
of type"wf-invalid-character-in-node-name"
, with aDOMError.SEVERITY_ERROR
severity, if necessary; - check if
the text content inside
Attr
,Element
,Comment
,Text
,CDATASection
nodes for invalid characters and generate aDOMError
of type"wf-invalid-character"
, with aDOMError.SEVERITY_ERROR
severity, if necessary; - check if
the data inside
ProcessingInstruction
nodes for invalid characters and generate aDOMError
of type"wf-invalid-character"
, with aDOMError.SEVERITY_ERROR
severity, if necessary;
- check if the attribute
-
false
- [optional] Do not check for XML well-formedness.
-
-
"element-content-whitespace"
-
true
- [required] (default)Keep all whitespaces in the document.
false
- [optional] Discard all
Text
nodes that contain whitespaces in element content, as described in [element content whitespace]. The implementation is expected to use the attributeText.isElementContentWhitespace
to determine if aText
node should be discarded or not.
The resolution of the system identifiers associated with entities is
done using Document.documentURI
. However, when the feature
"LS" defined in [DOM Level 3 Load and Save]
is supported by the DOM implementation, the parameter
"resource-resolver" can also be used on DOMConfiguration
objects attached to Document
nodes. If this parameter is
set, Document.normalizeDocument()
will invoke the resource
resolver instead of using Document.documentURI
.
See also the Document Object Model (DOM) Level 3 Core Specification.
- Since:
- DOM Level 3
Method Summary | |
boolean |
canSetParameter(java.lang.String name,
java.lang.Object value)
Check if setting a parameter to a specific value is supported. |
java.lang.Object |
getParameter(java.lang.String name)
Return the value of a parameter if known. |
DOMStringList |
getParameterNames()
The list of the parameters supported by this DOMConfiguration object and for which at least one value
can be set by the application. |
void |
setParameter(java.lang.String name,
java.lang.Object value)
Set the value of a parameter. |
Method Detail |
setParameter
public void setParameter(java.lang.String name, java.lang.Object value) throws org.w3c.dom.DOMException
- Set the value of a parameter.
getParameter
public java.lang.Object getParameter(java.lang.String name) throws org.w3c.dom.DOMException
- Return the value of a parameter if known.
canSetParameter
public boolean canSetParameter(java.lang.String name, java.lang.Object value)
- Check if setting a parameter to a specific value is supported.
getParameterNames
public DOMStringList getParameterNames()
- The list of the parameters supported by this
DOMConfiguration
object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.
|
|||||||||
Home >> All >> org >> apache >> xerces >> [ dom3 overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |