---
description: contains functions to operate with XML DOMConfiguration variables
---

# pdk.flow.xml.XmlDOMConfiguration

{% hint style="info" %}
This functions are based on Java `org.w3c.dom` package classes.

[https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/package-summary.html](https://docs.oracle.com/en/java/javase/11/docs/api/java.xml/org/w3c/dom/package-summary.html)

**You can always rely on Java documentation and examples!**
{% endhint %}

The parameter names used by the [DOMConfiguration](../../../../../structures/pdk.net.xml#domconfiguration) object are defined throughout the DOM Level 3 specifications. Names are case-insensitive. 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 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.

{% hint style="info" %}
Parameters are similar to features and properties used in SAX2 \[[SAX](http://www.saxproject.org/)].
{% endhint %}

The following list of parameters defined in the DOM:

**`"canonical-form"`**

`true`

\[_optional_] Canonicalize the document according to the rules specified in \[[Canonical XML](http://www.w3.org/TR/2001/REC-xml-c14n-20010315)], such as removing the `DocumentType` node (if any) from the tree, or removing superfluous namespace declarations from each element. 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. In addition, Setting this parameter to `true` will also set the state of the parameters listed below. Later changes to the state of one of those parameters will revert "canonical-form" back to&#x20;

`false`.&#x20;

Parameters set to `false`: "entities", " normalize-characters", "cdata-sections". Parameters set to `true`: "namespaces", "namespace-declarations", "well-formed", "element-content-whitespace". Other parameters are not changed unless explicitly specified in the description of the parameters.`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 into `Text` nodes. The new `Text` node is then combined with any adjacent `Text` node.

***

**`"check-character-normalization"`**

`true`

\[_optional_] Check if the characters in the document are [fully normalized](http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm), as defined in appendix B of \[[XML 1.1](http://www.w3.org/TR/2004/REC-xml11-20040204/)]. When a sequence of characters is encountered that fails normalization checking, an error with the `DOMError.type` equals to "check-character-normalization-failure" is issued.

`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_] Expose schema normalized values in the tree, such as [XML Schema normalized values](http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-nv) in the case of XML Schema. Since this parameter requires to have schema information, the "validate" parameter will also be set to `true`. Having this parameter activated when "validate" is `false` 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](http://www.w3.org/TR/2004/REC-xml-20040204)] and is only meant for schema languages other than Document Type Definition (DTD).

`false`

\[_required_] (_default_) Do not perform schema normalization on the tree.

***

**`"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\]](http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character). The implementation is expected to use the attribute `Text.isElementContentWhitespace` to determine if a `Text` node should be discarded or not.

***

**`"entities"`**

`true`

\[_required_] (_default_)Keep `EntityReference` nodes in the document.

`false`

\[_required_] Remove all `EntityReference` nodes from the document, putting the entity expansions directly in their place. `Text` nodes are normalized, as defined in `Node.normalize`. Only [unexpanded entity references](http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.rse) are kept in the document.

Note: This parameter does not affect `Entity` nodes.

***

**`"error-handler"`**

\[_required_] Contains a `DOMErrorHandler` object. If an error is encountered in the document, the implementation will call back the `DOMErrorHandler` registered using this parameter. The implementation may provide a default `DOMErrorHandler` 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 the `Document` 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](http://www.w3.org/TR/2004/REC-xml-infoset-20040204/)] .This forces the following parameters to `false`: " validate-if-schema", "entities", "datatype-normalization", "cdata-sections ".This forces the following parameters to `true`: " 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 with `getParameter` returns `true` only if the individual parameters specified above are appropriately set.

`false`

Setting `infoset` to `false` has no effect.

***

`"namespaces"`

`true`

\[_required_] (_default_) Perform the namespace processing as defined in .

`false`

\[_optional_] Do not perform the namespace processing.

***

`"namespace-declarations"`

This parameter has no effect if the parameter "namespaces" is set to `false`.

`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](http://www.w3.org/TR/1999/REC-xml-names-19990114/)] and \[[XML Namespaces 1.1](http://www.w3.org/TR/2004/REC-xml-names11-20040204/)] .

`false`

\[_required_]Discard all namespace declaration attributes. The namespace prefixes ( `Node.prefix`) are retained even if this parameter is set to `false`.

***

`"normalize-characters"`

`true`

\[_optional_] [Fully normalized](http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm) the characters in the document as defined in appendix B of \[[XML 1.1](http://www.w3.org/TR/2004/REC-xml11-20040204/)].

`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](http://www.w3.org/TR/2004/REC-xml-20040204#NT-S) defined in section 2.3 \[[XML 1.0](http://www.w3.org/TR/2004/REC-xml-20040204)]), 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 with `schema-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 the `schemaLocation` attribute) in a schema document (i.e. using schema `import` mechanisms) share the same `targetNamespace`, the schema specified by the user using this property will be used. If two schemas specified using this property share the same `targetNamespace` or have no namespace, the behavior is implementation dependent. If no location has been provided, this parameter is `null`.

Note: The `"schema-location"` parameter is ignored unless the "schema-type" parameter value is set. It is strongly recommended that `Document.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 is `null`.

Note: For XML Schema \[[XML Schema Part 1](http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/)] , applications must use the value `"http://www.w3.org/2001/XMLSchema"`. For XML DTD \[[XML 1.0](http://www.w3.org/TR/2004/REC-xml-20040204)], 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"` and `DOMError.relatedData` equals to the first `CDATASection` 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](http://www.w3.org/TR/2004/REC-xml-20040204)]. 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 to `false`, as specified in the description of the `Attr` interface;
* The value of the attribute `Text.isElementContentWhitespace` for all `Text` nodes;
* The value of the attribute `Attr.isId` for all `Attr` nodes;
* The attributes `Element.schemaTypeInfo` and `Attr.schemaTypeInfo`.

Note: "validate-if-schema" and "validate" are mutually exclusive, setting one of them to `true` will set the other one to `false`. Applications should also consider setting the parameter "well-formed" to `true`, which is the default for that option, when validating the document.

`false`

\[_required_] (_default_) Do not accomplish schema processing, including the internal subset processing. Default attribute values information are kept. 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 to `false`.

`false`

\[_required_] (_default_) No schema processing should be performed if the document has a schema, including internal subset processing. Default attribute values information are kept. 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 a `DOMError` of type `"wf-invalid-character-in-node-name"`, with a `DOMError.SEVERITY_ERROR` severity, if necessary;
* check if the text content inside `Attr`, `Element`, `Comment`, `Text`, `CDATASection` nodes for invalid characters and generate a `DOMError` of type `"wf-invalid-character"`, with a `DOMError.SEVERITY_ERROR` severity, if necessary;
* check if the data inside `ProcessingInstruction` nodes for invalid characters and generate a `DOMError` of type `"wf-invalid-character"`, with a `DOMError.SEVERITY_ERROR` severity, if necessary;

`false`\[_optional_] Do not check for XML well-formedness.

***

### All functions

* [canSetParameter](#cansetparameter)
* [getParameter](#getparameter)
* [getParameterNames](#getparameternames)
* [setParameter](#setparameter)

***

### canSetParameter

Check if setting a parameter to a specific value is supported.

Arguments:

* domConfiguration :: [pdk.net.xml.DOMConfiguration](../../../../../structures/pdk.net.xml#domconfiguration) - The dom configuration
* name :: [pdk.core.String](../../../../../structures/pdk.core#string) - The name of the parameter to check
* value :: [pdk.core.Any](../../../../../structures/pdk.core#any) - An object. if `null`, the returned value is `true`.

Result:

* output :: [pdk.core.Boolean](../../../../../structures/pdk.core#boolean) - `true` if the parameter could be successfully set to the specified value, or `false` if the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

Possible exceptions:

* [NullPointerException](../../../../exceptions/runtime-exceptions#nullpointerexception) - throws if the domConfiguration or name or value is `NULL`

***

### getParameter

Return the value of a parameter if known.

Arguments:

* domConfiguration :: [pdk.net.xml.DOMConfiguration](../../../../../structures/pdk.net.xml#domconfiguration) - The dom configuration
* name :: [pdk.core.String](../../../../../structures/pdk.core#string) - The name of the parameter

Result:

* output :: [pdk.core.Any](../../../../../structures/pdk.core#any) - The current object associated with the specified parameter or `null` if no object has been associated or if the parameter is not supported.

Possible exceptions:

* [NullPointerException](../../../../exceptions/runtime-exceptions#nullpointerexception) - throws if the domConfiguration or name `NULL`
* [DOMException](../../../../../structures/pdk.net.xml#domexception) - `NOT_FOUND_ERR`: Raised when the parameter name is not recognized

***

### getParameterNames

The list of the parameters supported by this [DOMConfiguration](../../../../../structures/pdk.net.xml#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.

Arguments:

* domConfiguration :: [pdk.net.xml.DOMConfiguration](../../../../../structures/pdk.net.xml#domconfiguration) - The dom configuration

Result:

* output :: [pdk.core.Array\<String>](../../../../../structures/pdk.core#array)

Possible exceptions:

* [NullPointerException](../../../../exceptions/runtime-exceptions#nullpointerexception) - throws if the domConfiguration or name `NULL`

***

### setParameter

Set the value of a parameter.

Arguments:

* domConfiguration :: [pdk.net.xml.DOMConfiguration](../../../../../structures/pdk.net.xml#domconfiguration) - The dom configuration
* name :: [pdk.core.String](../../../../../structures/pdk.core#string) - The name of the parameter to set
* value :: [pdk.core.Any](../../../../../structures/pdk.core#any) - The new value or `null` if the user wishes to unset the parameter.&#x20;

Result:

* no output

Possible exceptions:

* [NullPointerException](../../../../exceptions/runtime-exceptions#nullpointerexception) - throws if the domConfiguration or name `NULL`
* [DOMException](../../../../../structures/pdk.net.xml#domexception) - `NOT_FOUND_ERR`: Raised when the parameter name is not recognized. `NOT_SUPPORTED_ERR`: Raised when the parameter name is recognized but the requested value cannot be set. `TYPE_MISMATCH_ERR`: Raised if the value type for this parameter name is incompatible with the expected value type.

***
