Package com.ctc.wstx.api
Class EmptyElementHandler.SetEmptyElementHandler
- java.lang.Object
-
- com.ctc.wstx.api.EmptyElementHandler.SetEmptyElementHandler
-
- All Implemented Interfaces:
EmptyElementHandler
- Direct Known Subclasses:
EmptyElementHandler.HtmlEmptyElementHandler
- Enclosing interface:
- EmptyElementHandler
public static class EmptyElementHandler.SetEmptyElementHandler extends java.lang.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 theString.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
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>
mEmptyElements
-
Constructor Summary
Constructors Constructor Description SetEmptyElementHandler(java.util.Set<java.lang.String> emptyElements)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
allowEmptyElement(java.lang.String prefix, java.lang.String localName, java.lang.String nsURI, boolean allowEmpty)
-
-
-
Method Detail
-
allowEmptyElement
public boolean allowEmptyElement(java.lang.String prefix, java.lang.String localName, java.lang.String nsURI, boolean allowEmpty)
- Specified by:
allowEmptyElement
in interfaceEmptyElementHandler
- Parameters:
prefix
- The element's namespace prefix, null if not setlocalName
- The element's local namensURI
- The elements's namespace URI, null if not setallowEmpty
- 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.
-
-