Class EventFactory
This class is designed to returned events that are optimised for the type of sequence that it is being inserted in.
Non-namespace aware objects are lighter than namespace aware ones.
- Version:
- 27 April 2005
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIndicates whether the factory should generate namespace events. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new namespace aware factory for events.EventFactory(boolean isNamespaceAware) Creates a factory for events. -
Method Summary
Modifier and TypeMethodDescriptionmakeAttribute(String uri, String name, String value) Returns the attribute event from the name and value given.makeAttribute(String uri, String localName, String qName, String value) Returns the attribute event from the name and value given.Returns the close element event from the corresponding open element event.makeOpenElement(String uri, String name) Returns the open element event from the uri and name given.makeOpenElement(String uri, String localName, String qName) Returns the open element event from the uri and names given.
-
Field Details
-
isNamespaceAware
private boolean isNamespaceAwareIndicates whether the factory should generate namespace events.
-
-
Constructor Details
-
EventFactory
public EventFactory()Creates a new namespace aware factory for events. -
EventFactory
public EventFactory(boolean isNamespaceAware) Creates a factory for events.- Parameters:
isNamespaceAware-trueto create new namespace aware factory;falseotherwise.
-
-
Method Details
-
makeOpenElement
Returns the open element event from the uri and name given.If the factory is namespace aware, it returns an open element implementation using the namespace URI and the name.
If the factory is NOT namespace aware, it returns an open element implementation using the specified name.
Use this implementation if the name of the element is determined prior to the call of this method.
- Parameters:
uri- The namespace URI of the element (ignored if not namespace aware)name- The name of the element.- Returns:
- The open element event from the uri and name given.
-
makeOpenElement
Returns the open element event from the uri and names given.If the factory is namespace aware, it returns an open element implementation using the namespace URI and the local name.
If the factory is NOT namespace aware, it returns an open element implementation using the qName (namespace-prefixed name).
- Parameters:
uri- The namespace URI of the element (ignored if not namespace aware)localName- The local name of the element.qName- The qualified name of the element.- Returns:
- The open element event from the uri and name given.
-
makeCloseElement
Returns the close element event from the corresponding open element event.- Parameters:
open- The corresponding open element event.- Returns:
- The close element event from the corresponding open element event.
-
makeAttribute
Returns the attribute event from the name and value given.If the factory is namespace aware, it returns an attribute implementation using the namespace URI and the name.
If the factory is NOT namespace aware, it returns an attribute implementation using the specified name.
Use this implementation if the name of the element is determined prior to the call of this method.
- Parameters:
uri- The namespace URI of the attribute (ignored if not namespace aware)name- The name of the attribute.value- The value of the attribute.- Returns:
- The open element event from the uri and name given.
-
makeAttribute
Returns the attribute event from the name and value given.If the factory is namespace aware, it returns an attribute implementation using the namespace URI and the local name.
If the factory is NOT namespace aware, it returns an attribute implementation using the qName (namespace-prefixed name).
- Parameters:
uri- The namespace URI of the attribute (ignored if not namespace aware)localName- The local name of the attribute.qName- The qualified name of the attribute.value- The value of the attribute.- Returns:
- The open element event from the uri and name given.
-