Hi,
dudleygb wrote:
>
> Hi guys,
>
> Whats the easiest way to trim whitespace from an incomming XML. Its
> unmarshalling correctly but I want to eliminate the whitespace in the POJO
> fields....any pointers much appreciated
Derive from the ReaderWrapper and overload the getValue method. As hack:
HierarchicalStreamDriver driver = new Xpp3DomDriver();
XStream xstream = new XStream((HierarchicalStreamDriver)null);
Object o = xstream.unmarshal(
new ReaderWrapper(driver.createReader(inputStream))
{
public String getValue() {
return super.getValue().trim();
}
}
);
However, if you do not want this behavior for all XML elements you might use
the getNodeName call to check the current element's name. Oh, well, and
getValue() might also return null ;-)
- Jörg
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email