Uploaded image for project: 'Axiom'
  1. Axiom
  2. AXIOM-372

Axiom should reject attempts to create illegal namespace declarations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.2.12
    • 1.2.13
    • API, DOOM, LLOM
    • None

    Description

      According to the Namespaces in XML 1.0 (Second Edition) specification, it is illegal to bind a namespace prefix to the empty namespace URI. Only the default namespace can have an empty URI:

      "[Definition: If the attribute name matches PrefixedAttName, then the NCName gives the namespace prefix, used to associate element and attribute names with the namespace name in the attribute value in the scope of the element to which the declaration is attached. In such declarations, the namespace name may not be empty. ]"

      (Note that this constraint was dropped in the Namespaces in XML 1.1 specification)

      OMElement#declareNamespace doesn't enforce this constraint and namespace declarations that violate this requirement are silently dropped during serialization (by code in OMSerializerUtil#isAssociated). This behavior is problematic because it may result in subtle issues such as unbound namespace prefixes.

      The serialization code should throw an exception if the object model contains an invalid namespace declaration. We should also make sure that Axiom itself never generates such invalid namespace declarations. Indeed, the code in OMSerializerUtil#isAssociated has the following comment:

      "Cannot associate a prefix with an unqualifed name. However sometimes axiom creates a fake prefix name if xmns="" is not in effect."

      If this is true, then Axiom needs to be fixed.

      Attachments

        Activity

          People

            veithen Andreas Veithen
            veithen Andreas Veithen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: