Hi everyone, 

I would like to read an XML stream with readValues, but if I wish to do 
something like:

*mapper.readValues("<Content><a>i1</a><b>1</b></Content><Content><a>i2</a><b>2</b></Content><Content><a>i3</a><b>3</b></Content>")*


*Find a concrete example in *
*https://gist.github.com/gapag/8856983e48d94b57c5c63c46dc477cbc* 
<https://gist.github.com/gapag/8856983e48d94b57c5c63c46dc477cbc>

Then I get the error:
com.fasterxml.jackson.databind.exc.MismatchedInputException: 
Cannot construct instance of `bet.algotech.persistence.file.Content` 
(although at least one Creator exists): 
no String-argument constructor/factory method to deserialize from String 
value ('i1')

Note that instead if I provide

*mapper.readValues("<Anything><Content><a>i1</a><b>1</b></Content><Content><a>i2</a><b>2</b></Content><Content><a>i3</a><b>3</b></Content></Anything>")*

then everything works. 
<Anything> can be whatever  - Jackson just needs a start and end tag which 
does not need to have a corresponding POJO defined in the code.


*ΒΆ My question is:* Is there a straightforward way to make Jackson work 
under the assumption that the XML stream contains a sequence of objects of 
the same type, 

-- similarly as it currently happens for the Json case """{"a":"i1", 
"b":1}{"a":"i2", "b":2}{"a":"i3", "b":2}""" (where no explicit array is 
given) --

so that this use case does not fail?

Thanks in advance,

-gapag

-- 
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/310be849-73d5-4dbe-aa35-ad38f32642dbn%40googlegroups.com.

Reply via email to