Joda System API

org.joda.property.xml
Interface XMLFilter

All Known Implementing Classes:
ElementNameXMLFilter

public interface XMLFilter

XMLConvertorFilter acts as a filter on the XMLData produced by the XMLConvertors. On output the filters are run after the convertors. On input the filters are run before. Unlike convertors, all filters are called.

The interface returns data in the XMLData format, which is a minimal DOM structure. Each convertor should only return the XMLData structure for its own internal data passed on the passed in object. If the object contains references to other objects that have their own XML convertors, the content field should be set to the object.

Typically, this means that an XMLData instance has a number of children, each of which have either String or object content. However, if an object needs to create a more complex structure it can do.

Author:
Stephen Colebourne, Andy Lehane

Method Summary
 boolean filterChildren()
          Should the children of the XMLData be filtered as well?
 void filterInputXMLDataOnEndTag(XMLConvertorContext context, ModelElement element, XMLData data)
          Filter the XMLData representation of an object on input when the end tag is reached.
 void filterInputXMLDataOnStartTag(XMLConvertorContext context, XMLData data)
          Filter the XMLData representation of an object on input.
 boolean filterOutputXMLData(XMLConvertorContext context, XMLData data)
          Filter the XMLData representation of an object.
 

Method Detail

filterChildren

public boolean filterChildren()
Should the children of the XMLData be filtered as well?

Returns:
true to ensure that the filter method is called for each XMLData child

filterOutputXMLData

public boolean filterOutputXMLData(XMLConvertorContext context,
                                   XMLData data)
Filter the XMLData representation of an object. Typical uses are to add or remove an attribute or element.

Parameters:
context - the context for the output
data - the XMLData to filter
Returns:
true to retain the element, false to remove

filterInputXMLDataOnStartTag

public void filterInputXMLDataOnStartTag(XMLConvertorContext context,
                                         XMLData data)
Filter the XMLData representation of an object on input. Typical uses are to add or remove an attribute or element.

Parameters:
context - the context for the output
data - the XMLData to filter

filterInputXMLDataOnEndTag

public void filterInputXMLDataOnEndTag(XMLConvertorContext context,
                                       ModelElement element,
                                       XMLData data)
Filter the XMLData representation of an object on input when the end tag is reached. This gives us access to the XML and the object created. Typical uses of this is to change fields of an object on input.

Parameters:
context - The contect for the input
data - The xml data to filter

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.