Top Description Inners Methods
com.ctc.wstx.api

public Interface EmptyElementHandler

Known Direct Implementers
com.ctc.wstx.api.EmptyElementHandler.SetEmptyElementHandler
Imports
java.util.Set, .TreeSet

Optional handler used to determine if a specific empty element (by name) should be allowed to use the self-closing syntax instead of having a separate end tag.
Since
4.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
EmptyElementHandler.HtmlEmptyElementHandler

HTML specific empty element handler.

public static class
EmptyElementHandler.SetEmptyElementHandler

Handler that uses a Set of Strings.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

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

Method Detail

allowEmptyElementback to summary
public boolean allowEmptyElement(String prefix, String localName, String nsURI, boolean allowEmpty)
Parameters
prefix:String

The element's namespace prefix, null if not set

localName:String

The element's local name

nsURI:String

The elements's namespace URI, null if not set

allowEmpty:boolean

The allow empty setting specified by the caller.

Returns:boolean

True if the empty element can be self-closing. False if a separate end tag should be written.

com.ctc.wstx.api back to summary

public Class EmptyElementHandler.HtmlEmptyElementHandler

extends SetEmptyElementHandler
Class Inheritance

HTML specific empty element handler. Extends the SetEmptyElementHandler and configures the HTML elements that must be self-closing according to the W3C: http://www.w3.org/TR/html4/index/elements.html

Note that element name comparison is case-insensitive as required by HTML specification.

Field Summary

Modifier and TypeField and Description
private static final EmptyElementHandler.HtmlEmptyElementHandler
Inherited from com.ctc.wstx.api.EmptyElementHandler.SetEmptyElementHandler:
mEmptyElements

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static EmptyElementHandler.HtmlEmptyElementHandler
Inherited from com.ctc.wstx.api.EmptyElementHandler.SetEmptyElementHandler:
allowEmptyElement

Field Detail

sInstanceback to summary
private static final EmptyElementHandler.HtmlEmptyElementHandler sInstance

Constructor Detail

HtmlEmptyElementHandlerback to summary
protected HtmlEmptyElementHandler()

Method Detail

getInstanceback to summary
public static EmptyElementHandler.HtmlEmptyElementHandler getInstance()
com.ctc.wstx.api back to summary

public Class EmptyElementHandler.SetEmptyElementHandler

extends Object
implements EmptyElementHandler
Class Inheritance
All Implemented Interfaces
com.ctc.wstx.api.EmptyElementHandler
Known Direct Subclasses
com.ctc.wstx.api.EmptyElementHandler.HtmlEmptyElementHandler

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).

Field Summary

Modifier and TypeField and Description
protected final Set<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
allowEmptyElement(String
The element's namespace prefix, null if not set
prefix
,
String
The element's local name
localName
,
String
The elements's namespace URI, null if not set
nsURI
,
boolean
The allow empty setting specified by the caller.
allowEmpty
)

Implements com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

mEmptyElementsback to summary
protected final Set<String> mEmptyElements

Constructor Detail

SetEmptyElementHandlerback to summary
public SetEmptyElementHandler(Set<String> emptyElements)

Method Detail

allowEmptyElementback to summary
public boolean allowEmptyElement(String prefix, String localName, String nsURI, boolean allowEmpty)

Implements com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

Parameters
prefix:String

Doc from com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

The element's namespace prefix, null if not set

localName:String

Doc from com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

The element's local name

nsURI:String

Doc from com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

The elements's namespace URI, null if not set

allowEmpty:boolean

Doc from com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

The allow empty setting specified by the caller.

Returns:boolean

Doc from com.ctc.wstx.api.EmptyElementHandler.allowEmptyElement.

True if the empty element can be self-closing. False if a separate end tag should be written.

Annotations
@Override