Add FromXmlParser.Feature.RETAIN_ROOT_ELEMENT
to allow lossless round-trip via Tree Model
#484
Labels
pr-needed
Feature request for which PR likely needed (no active development but idea is workable)
Normally XML document like:
would be exposed as equivalent to JSON
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:
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.Note: one potential problem we do have is the "too late" passing of format-feature flags -- it would be particularly gnarly problem here.
The text was updated successfully, but these errors were encountered: