This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Deserializing a Stream of Children Using XStream Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Deserializing a Stream of Children Using XStream" Watch "Deserializing a Stream of Children Using XStream" New topic
Author

Deserializing a Stream of Children Using XStream

Reginald Blank
Greenhorn

Joined: Mar 11, 2011
Posts: 17
I have an XML file of the following form:



I would like to ignore (skip) the Ignore tag.
I don't want to deserialize the Children tag itself.
I want to read the Child tags one at a time using XStream.createObjectInputStream(...).
I don't want to use annotations and I have no control over the XML format.

I can skip the ignore tag using:



which seems a bit hacky.

Unsurprisingly I get the following exception for the Children tag:


com.thoughtworks.xstream.mapper.CannotResolveClassException: Children


It doesn't look like I can use xpaths in the XStream.alias(...) method which would have been nice.
I would like to set the 'root' to be Root/Children tag but I can't see how to do that either.
The solution needs to be memory efficient, i.e. serial not DOM based.
Any help greatly appreciated.
 
GeeCON Prague 2014
 
subject: Deserializing a Stream of Children Using XStream