com.ctc.wstx.api
Class EmptyElementHandler.SetEmptyElementHandler

java.lang.Object
  extended by com.ctc.wstx.api.EmptyElementHandler.SetEmptyElementHandler
All Implemented Interfaces:
EmptyElementHandler
Direct Known Subclasses:
EmptyElementHandler.HtmlEmptyElementHandler
Enclosing interface:
EmptyElementHandler

public static class EmptyElementHandler.SetEmptyElementHandler
extends Object
implements EmptyElementHandler

Handler that uses a Set of Strings. If the local part of the element's QName is contained in the Set the element is allowed to be empty.

Users of this class are encouraged to use a TreeSet with the String.CASE_INSENSITIVE_ORDER comparator if case-insensitive comparison is needed (like when dealing with HTML tags).


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.ctc.wstx.api.EmptyElementHandler
EmptyElementHandler.HtmlEmptyElementHandler, EmptyElementHandler.SetEmptyElementHandler
 
Field Summary
protected  Set mEmptyElements
           
 
Constructor Summary
EmptyElementHandler.SetEmptyElementHandler(Set emptyElements)
           
 
Method Summary
 boolean allowEmptyElement(String prefix, String localName, String nsURI, boolean allowEmpty)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mEmptyElements

protected final Set mEmptyElements
Constructor Detail

EmptyElementHandler.SetEmptyElementHandler

public EmptyElementHandler.SetEmptyElementHandler(Set emptyElements)
Method Detail

allowEmptyElement

public boolean allowEmptyElement(String prefix,
                                 String localName,
                                 String nsURI,
                                 boolean allowEmpty)
Specified by:
allowEmptyElement in interface EmptyElementHandler
Parameters:
prefix - The element's namespace prefix, null if not set
localName - The element's local name
nsURI - The elements's namespace URI, null if not set
allowEmpty - The allow empty setting specified by the caller.
Returns:
True if the empty element can be self-closing. False if a separate end tag should be written.


Copyright © 2011 Codehaus. All Rights Reserved.