On Sat, Jul 11, 2020 at 1:37 AM Łukasz Gebel <[email protected]> wrote:
>
> Thanks Tatu,
>
> it means I need to use e.g Jaxb or other tool that operates on Xml for xml 
> parsing, and get elemnts I need.
>
> I wanted to have one code for formats, and it would work in jackson if not 
> this edge case.

If we are talking about "rawest" XML content, JAXB would not expose it
to you either (content you see is pre-processed
to normalize white-space, entities), but I am guessing you are talking
about access to content as DOM, which is somewhat
cleaned up, but has full XML Infoset contents available.
While that is something Jackson could theoretically support -- I
actually thought a bit about this wrt 2.12 -- it is not currently
supported.

Jackson 2.12 actually adds (finally!) proper support for `JsonNode` on
XML, so that duplicate properties will be retained,
and character data segments too (formerly either elements or cdata
retained, not both). This will get you little bit closer,
but not quite there, since the full ordering is not retained (that is,
cdata is under key "", empty String, under first location
it was seen).

Now... to get further, it'd be necessary to expose a "native" XML
type, like `org.w3c.dom.Node` (or `Element`?).
Currently binding would try to re-parse textual content, but it would
be relatively easy to change that, possibly along
with configuration setting to select new or old approach.

If this makes sense, would you like to file an issue for such a feature?

-+ Tatu +-

>
> sob., 11 lip 2020, 05:57 użytkownik Tatu Saloranta <[email protected]> 
> napisał:
>>
>> On Fri, Jul 10, 2020 at 8:29 PM Łukasz Gebel <[email protected]> wrote:
>> >
>> > Hi!
>> >
>> > I try to achieve the following thing using Jackson-data-format-xml:
>> > <rootElement><firstElement>value</firstElement><rawElement>...</rawElement><rootElement>
>> >
>> > And after deserializing it I need to read the whole rawElement as well as 
>> > its children as String property (without any changes).
>> > I tried to use @JsonDeserialize & custom deserializer, but it works on 
>> > JsonNode abstraction & I cannot get to the raw XML values.
>>
>> There is no way to get underlying "raw" XML content in any way: most
>> Java parsers typically do not expose it (as they do not necessarily
>> buffer undecoded content but handle entity replacement, linefeed
>> normalization as so on).
>>
>> -+ Tatu +-
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "jackson-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jackson-user/CAL4a10iFYDvwabMqKauzNOzBNpWAnj255h0qhYBVucNtHW%2Bs%3Dg%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jackson-user/CAF-mXfm-94BdhCLAfXCYuQZNijRAbqmSBdPBAY_UR56jTt25PQ%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jackson-user/CAL4a10hdvX%3Dja9NKd1ipw_fKha9JDFEXcv55tNSa%2Bn13tYtjDQ%40mail.gmail.com.

Reply via email to