public abstract class XMLEventFactory extends Object
Modifier | Constructor | Description |
---|---|---|
protected |
Protected constructor to prevent instantiation. |
Modifier and Type | Method | Description |
---|---|---|
abstract Attribute |
createAttribute |
Create a new Attribute |
abstract Attribute |
createAttribute |
Create a new Attribute |
abstract Attribute |
createAttribute |
Create a new Attribute |
abstract Characters |
createCData |
Create a Characters event with the CData flag set to true |
abstract Characters |
createCharacters |
Create a Characters event, this method does not check if the content is all whitespace. |
abstract Comment |
createComment |
Create a comment. |
abstract DTD |
createDTD |
Create a document type definition event This string contains the entire document type declaration that matches the doctypedecl in the XML 1.0 specification |
abstract EndDocument |
createEndDocument() |
Creates a new instance of an EndDocument event |
abstract EndElement |
createEndElement |
Create a new EndElement |
abstract EndElement |
createEndElement |
Create a new EndElement |
abstract EndElement |
createEndElement |
Create a new EndElement |
abstract EntityReference |
createEntityReference |
Creates a new instance of a EntityReference event |
abstract Characters |
createIgnorableSpace |
Create an ignorable space |
abstract Namespace |
createNamespace |
Create a new default Namespace |
abstract Namespace |
createNamespace |
Create a new Namespace |
abstract ProcessingInstruction |
createProcessingInstruction |
Create a processing instruction |
abstract Characters |
createSpace |
Create a Characters event with the isSpace flag set to true |
abstract StartDocument |
createStartDocument() |
Creates a new instance of a StartDocument event |
abstract StartDocument |
createStartDocument |
Creates a new instance of a StartDocument event |
abstract StartDocument |
createStartDocument |
Creates a new instance of a StartDocument event |
abstract StartDocument |
createStartDocument |
Creates a new instance of a StartDocument event |
abstract StartElement |
createStartElement |
Create a new StartElement. |
abstract StartElement |
createStartElement |
Create a new StartElement. |
abstract StartElement |
createStartElement |
Create a new StartElement. |
abstract StartElement |
createStartElement |
Create a new StartElement. |
static XMLEventFactory |
newDefaultFactory() |
Creates a new instance of the XMLEventFactory builtin system-default implementation. |
static XMLEventFactory |
newFactory() |
Creates a new instance of the factory. |
static XMLEventFactory |
newFactory |
Create a new instance of the factory. |
static XMLEventFactory |
newInstance() |
Creates a new instance of the factory in exactly the same manner as the newFactory() method. |
static XMLEventFactory |
newInstance |
Deprecated. This method has been deprecated to maintain API consistency. |
abstract void |
setLocation |
This method allows setting of the Location on each event that is created by this factory. |
protected XMLEventFactory()
newFactory()
instead.public static XMLEventFactory newDefaultFactory()
XMLEventFactory
builtin system-default implementation.XMLEventFactory
builtin system-default implementation.public static XMLEventFactory newInstance() throws FactoryConfigurationError
newFactory()
method.XMLEventFactory
FactoryConfigurationError
- if an instance of this factory cannot be loadedpublic static XMLEventFactory newFactory() throws FactoryConfigurationError
XMLEventFactory
implementation class to load. Once an application has obtained a reference to a XMLEventFactory
, it can use the factory to configure and obtain stream instances.
XMLEventFactory
FactoryConfigurationError
- in case of service configuration error or if the implementation is not available or cannot be instantiated.@Deprecated(since="1.7") public static XMLEventFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError
newFactory(java.lang.String, java.lang.ClassLoader)
method defines no changes in behavior.factoryId
- Name of the factory to find, same as a property nameclassLoader
- classLoader to useFactoryConfigurationError
- if an instance of this factory cannot be loadedpublic static XMLEventFactory newFactory(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError
This method uses the following ordered lookup procedure to determine the XMLEventFactory implementation class to load:
factoryId
. Use the value of the property factoryId
set in the configuration file, jaxp.properties by default. If the file exists and the property factoryId
is specified in the file, its value will be used as the implementation class.
If factoryId
is "javax.xml.stream.XMLEventFactory", use the service-provider loading facility, defined by the ServiceLoader
class, to attempt to locate and load an implementation of the service using the specified ClassLoader
. If classLoader
is null, the default loading mechanism will apply: That is, the service-provider loading facility will use the current thread's context class loader to attempt to load the service. If the context class loader is null, the system class loader will be used.
Otherwise, throws a FactoryConfigurationError
.
Note that this is a new method that replaces the deprecated newInstance(String factoryId, ClassLoader classLoader)
method. No changes in behavior are defined by this replacement method relative to the deprecated method.
factoryId
- Name of the factory to find, same as a property nameclassLoader
- classLoader to useFactoryConfigurationError
- in case of service configuration error or if the implementation is not available or cannot be instantiated.public abstract void setLocation(Location location)
location
- the location to set on each event createdpublic abstract Attribute createAttribute(String prefix, String namespaceURI, String localName, String value)
prefix
- the prefix of this attribute, may not be nullnamespaceURI
- the attribute value is set to this value, may not be nulllocalName
- the local name of the XML name of the attribute, localName cannot be nullvalue
- the attribute value to set, may not be nullpublic abstract Attribute createAttribute(String localName, String value)
localName
- the local name of the XML name of the attribute, localName cannot be nullvalue
- the attribute value to set, may not be nullpublic abstract Attribute createAttribute(QName name, String value)
name
- the qualified name of the attribute, may not be nullvalue
- the attribute value to set, may not be nullpublic abstract Namespace createNamespace(String namespaceURI)
namespaceURI
- the default namespace uripublic abstract Namespace createNamespace(String prefix, String namespaceUri)
prefix
- the prefix of this namespace, may not be nullnamespaceUri
- the attribute value is set to this value, may not be nullpublic abstract StartElement createStartElement(QName name, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces)
name
- the qualified name of the attribute, may not be nullattributes
- an optional unordered set of objects that implement Attribute to add to the new StartElement, may be nullnamespaces
- an optional unordered set of objects that implement Namespace to add to the new StartElement, may be nullpublic abstract StartElement createStartElement(String prefix, String namespaceUri, String localName)
prefix
- the prefix of the QName of the new StartElementnamespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementpublic abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces)
prefix
- the prefix of the QName of the new StartElementnamespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementattributes
- an unordered set of objects that implement Attribute to add to the new StartElementnamespaces
- an unordered set of objects that implement Namespace to add to the new StartElementpublic abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces, NamespaceContext context)
prefix
- the prefix of the QName of the new StartElementnamespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementattributes
- an unordered set of objects that implement Attribute to add to the new StartElement, may be nullnamespaces
- an unordered set of objects that implement Namespace to add to the new StartElement, may be nullcontext
- the namespace context of this elementpublic abstract EndElement createEndElement(QName name, Iterator<? extends Namespace> namespaces)
name
- the qualified name of the EndElementnamespaces
- an optional unordered set of objects that implement Namespace that have gone out of scope, may be nullpublic abstract EndElement createEndElement(String prefix, String namespaceUri, String localName)
prefix
- the prefix of the QName of the new StartElementnamespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementpublic abstract EndElement createEndElement(String prefix, String namespaceUri, String localName, Iterator<? extends Namespace> namespaces)
prefix
- the prefix of the QName of the new StartElementnamespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementnamespaces
- an unordered set of objects that implement Namespace that have gone out of scope, may be nullpublic abstract Characters createCharacters(String content)
content
- the string to createpublic abstract Characters createCData(String content)
content
- the string to createpublic abstract Characters createSpace(String content)
content
- the content of the space to createpublic abstract Characters createIgnorableSpace(String content)
content
- the space to createpublic abstract StartDocument createStartDocument()
public abstract StartDocument createStartDocument(String encoding, String version, boolean standalone)
encoding
- the encoding styleversion
- the XML versionstandalone
- the status of standalone may be set to "true" or "false"public abstract StartDocument createStartDocument(String encoding, String version)
encoding
- the encoding styleversion
- the XML versionpublic abstract StartDocument createStartDocument(String encoding)
encoding
- the encoding stylepublic abstract EndDocument createEndDocument()
public abstract EntityReference createEntityReference(String name, EntityDeclaration declaration)
name
- The name of the referencedeclaration
- the declaration for the eventpublic abstract Comment createComment(String text)
text
- The text of the commentpublic abstract ProcessingInstruction createProcessingInstruction(String target, String data)
target
- The target of the processing instructiondata
- The text of the processing instructionpublic abstract DTD createDTD(String dtd)
dtd
- the text of the document type definition
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.xml/javax/xml/stream/XMLEventFactory.html