Skip to content

XML namespace for JAXB not correctly set #343

Description

@pieterbos

Fixing this issue will open a whole can of worms.

Each package being mapped to XML should contain a package-info.java, which defines the XML namespace. That is currently not the case in archie.

that is not a huge problem, because XML is being parsed, regardless of set namespace, although the generated XML is potentially problematic.

However, if we want to set the namespace, we enter a place with tons of issues:

  • RMQueryContext xpath expressions suddenly become namespaced!

  • JAXB adds a namespace prefix when you set the elementFormDefault to Qualified, as it should be for OpenEHR

  • when set to qualified, JAXB only does xmlns="" when a single namespace is used

  • when set to unqualified, jaxb does not parse xmlns="http://schemas.openehr.org/v1"

  • JAXB detects the namespace with URI "", for any Map it might encounter

  • apparently we have some maps left in the AOM

    • ResourceDescriptionItem is accidentally used in XmlResourceDescription, in annotation
    • LanguageSection has a couple of maps and needs an adapter
    • archetype.otherMetaData
    • operationalTemplate.terminologyExtracts
    • operationalTemplate.componentTerminologies
    • probably more. To find: set a breakpoint in com.sun.xml.bind.v2.runtime.NameBuilder::createName, condition nsUri == null || nsUri.equalsIgnoreCase("")
  • XML with a namespace will no longer parse

    • parsing without namespaces is very possible, using a XmlReader that is not namespace aware, but requires client code updating

Encountered because I wanted to use the regular XML parser for OPT default values - which did not work without elaborate tricks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions