Skip to content

Add FromXmlParser.Feature.WRAP_ROOT_ELEMENT_NAME to allow lossless round-trip via Tree Model #484

@cowtowncoder

Description

@cowtowncoder

Normally XML document like:

<root>
  <value>3</value>
</root>

would be exposed as equivalent to JSON

{ "value" : "3" }

since that is typically the straight-forward and suitable representation for databinding use.

But when reading "as a tree", into JsonNode, this will lose a small part of information, namely the name of root element.
User has no way to access this information, and although technically we could store it for access, API would feel clunky.

So instead perhaps there should be an option to instead expose said document like so:

{
  "root" : {
     "value" : "3"
  }
}

This would be particularly useful when coupled with the recently added ToXmlGenerator.Feature.UNWRAP_ROOT_OBJECT_NODE (added via #441) as users could then get full round-tripping of XML documents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions