ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Veithen (Created) (JIRA)" <>
Subject [jira] [Created] (AXIOM-402) The namespace repairing performed by the serializer should be configurable
Date Tue, 29 Nov 2011 22:49:39 GMT
The namespace repairing performed by the serializer should be configurable

                 Key: AXIOM-402
             Project: Axiom
          Issue Type: Improvement
          Components: API
            Reporter: Andreas Veithen
            Priority: Minor

When serializing (with or without caching) an object model tree, Axiom performs namespace
repairing. This comprises two things:

1. Axiom generates namespace declarations for namespace bindings that are visibly used (in
element or attribute names) but for which no corresponding declaration is in scope. This is
important for two reasons:

* It ensures that Axiom always produces XML that is well-formed with respect to namespaces,
even when serializing a subtree.
* Some operations (such as moving elements from one location to another) may result in an
object model that is not well-formed with respect to namespaces. The serializer therefore
needs to add the missing namespace declarations on-the-fly.

2. Redundant namespace declarations are removed. A namespace declaration is considered redundant
if it corresponds to a namespace binding for which another namespace declaration is already
in scope. The primary reason for this is that when creating or modifying a tree programmatically,
it will in general contain such redundant namespace declarations. This occurs when creating
an orphaned element and adding it to a location in the tree where an appropriate namespace
declaration is already in scope (this contrasts with the case where the element is created
directly as the child of an existing element). It is also likely that OMSourcedElements backed
by some types of OMDataSources would generate lots of redundant namespace declarations.

It should be noted that these operations don't alter the namespace context of any of the elements
being serialized. They don't alter the XPath data model in any way either. This is a consequence
of section 5.4 (as well as the last sentence of section 5.3) of the XPath 1.0 specification.
Therefore other standards based on the XPath data model (such as XML C14N and XML Signature)
are not affected by the removal of redundant namespace declarations. Finally in the XML infoset
(as defined by the XML Information Set specification) the removal of a namespace declaration
only modifies the [namespace attributes] property (which contains attribute information items,
and not namespace information items) of the element information item, but not the [in-scope
namespaces] property.

There will nevertheless be a problem in some very particular situations, e.g. when a document
containing a redundant namespace is parsed into an Axiom tree and later serialized and processed
by an application or service that fails to implement the aforementioned standards correctly.
For these situations, Axiom should allow to disable the removal of redundant namespace declarations.

One can also see that if one parses an XML document and later serializes it again without
doing any structural modifications, then it will automatically be well formed with respect
to namespaces. In that case, namespace repairing is just unnecessary overhead. Therefore Axiom
should also allow to disable namespace repairing altogether.

To summarize, Axiom should have a configuration option (e.g. in OMOutputFormat) to choose
the namespace repairing mode, with three supported modes:
* Default: complete namespace repairing with removal of redundant namespace declarations.
* Namespace repairing without removal of redundant namespace declarations.
* No namespace repairing at all.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message