Hi Amanda,

Amanda Varella wrote:

> Thank you Jörg,
> *
> *
> I think the ReflectionConverter won´t work because I don´t have knowledge
> of all attributes I would like to ignore.
>
> I think this could be a quite common need: to ignore unknown attributes.
> Do you know if there is a converter that already implement this?

This is nothing a converter does. If a converter detects another element in 
the XML stream, it either knows itself, what to do with it or the generic 
ones (like the ReflectionConverter) will call XStream's mapper chain to 
resolve that element as field.

However, you may insert an own mapper into this chain that will ignore 
missing fields. Such an implementation is available in the 
CustomMapperTest.testCanBeUsedToOmitUnexpectedElements in XStream's 
acceptance package, but it comes with a drawback: Implicit collections/array 
or maps will no longer work. However, that might be acceptable in your case.

> By the way, I´m gonna take a look at the converter tutorial

Look into the unmarshal method of the last but one converter implementation 
of the tutorial. It has a while loop over all elements of the current 
container and will act depending on the name of the element. You may simply 
act only for those elements you want to handle.

Cheers,
Jörg


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to