* #### newDefaultFactory
public static [XMLEventFactory](../../../javax/xml/stream/XMLEventFactory.html "class in javax.xml.stream") newDefaultFactory()
Creates a new instance of the `XMLEventFactory` builtin system-default implementation.
Returns:
A new instance of the `XMLEventFactory` builtin system-default implementation.
Since:
9
* #### newInstance
public static [XMLEventFactory](../../../javax/xml/stream/XMLEventFactory.html "class in javax.xml.stream") newInstance()
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Creates a new instance of the factory in exactly the same manner as the[newFactory()](../../../javax/xml/stream/XMLEventFactory.html#newFactory--) method.
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- if an instance of this factory cannot be loaded
* #### newFactory
public static [XMLEventFactory](../../../javax/xml/stream/XMLEventFactory.html "class in javax.xml.stream") newFactory()
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Create a new instance of the factory.
This static method creates a new factory instance. This method uses the following ordered lookup procedure to determine the XMLEventFactory implementation class to load:
* Use the javax.xml.stream.XMLEventFactory system property.
* Use the configuration file "stax.properties". The file is in standard[Properties](../../../java/util/Properties.html "class in java.util") format and typically located in the`conf` directory of the Java installation. It contains the fully qualified name of the implementation class with the key being the system property defined above.
The stax.properties file is read only once by the implementation and its values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in stax.properties after it has been read for the first time.
Use the jaxp configuration file "jaxp.properties". The file is in the same format as stax.properties and will only be read if stax.properties does not exist.
* Use the service-provider loading facility, defined by the[ServiceLoader](../../../java/util/ServiceLoader.html "class in java.util") class, to attempt to locate and load an implementation of the service using the [default loading mechanism](../../../java/util/ServiceLoader.html#load-java.lang.Class-): the service-provider loading facility will use the [current thread's context class loader](../../../java/lang/Thread.html#getContextClassLoader--) to attempt to load the service. If the context class loader is null, the [system class loader](../../../java/lang/ClassLoader.html#getSystemClassLoader--) will be used.
* Otherwise, the [system-default](../../../javax/xml/stream/XMLEventFactory.html#newDefaultFactory--) implementation is returned.
Once an application has obtained a reference to a XMLEventFactory it can use the factory to configure and obtain stream instances.
Note that this is a new method that replaces the deprecated newInstance() method. No changes in behavior are defined by this replacement method relative to the deprecated method.
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- in case of [service configuration error](../../../java/util/ServiceConfigurationError.html "class in java.util") or if the implementation is not available or cannot be instantiated.
* #### newInstance
[@Deprecated](../../../java/lang/Deprecated.html "annotation in java.lang")([since](../../../java/lang/Deprecated.html#since--)="1.7")
public static [XMLEventFactory](../../../javax/xml/stream/XMLEventFactory.html "class in javax.xml.stream") newInstance([String](../../../java/lang/String.html "class in java.lang") factoryId,
[ClassLoader](../../../java/lang/ClassLoader.html "class in java.lang") classLoader)
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Deprecated.
Create a new instance of the factory
Parameters:
`factoryId` \- Name of the factory to find, same as a property name
`classLoader` \- classLoader to use
Returns:
the factory implementation
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- if an instance of this factory cannot be loaded
* #### newFactory
public static [XMLEventFactory](../../../javax/xml/stream/XMLEventFactory.html "class in javax.xml.stream") newFactory([String](../../../java/lang/String.html "class in java.lang") factoryId,
[ClassLoader](../../../java/lang/ClassLoader.html "class in java.lang") classLoader)
throws [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")
Create a new instance of the factory. If the classLoader argument is null, then the ContextClassLoader is used.
This method uses the following ordered lookup procedure to determine the XMLEventFactory implementation class to load:
* Use the value of the system property identified by `factoryId`.
* Use the configuration file "stax.properties". The file is in standard[Properties](../../../java/util/Properties.html "class in java.util") format and typically located in the conf directory of the Java installation. It contains the fully qualified name of the implementation class with the key being the system property defined above.
The stax.properties file is read only once by the implementation and its values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to check for its existence. It is not possible to change the value of any property in stax.properties after it has been read for the first time.
Use the jaxp configuration file "jaxp.properties". The file is in the same format as stax.properties and will only be read if stax.properties does not exist.
* If `factoryId` is "javax.xml.stream.XMLEventFactory", use the service-provider loading facility, defined by the[ServiceLoader](../../../java/util/ServiceLoader.html "class in java.util") class, to attempt to [locate and load](../../../java/util/ServiceLoader.html#load-java.lang.Class-java.lang.ClassLoader-) an implementation of the service using the specified `ClassLoader`. If `classLoader` is null, the [default loading mechanism](../../../java/util/ServiceLoader.html#load-java.lang.Class-) will apply: That is, the service-provider loading facility will use the [current thread's context class loader](../../../java/lang/Thread.html#getContextClassLoader--) to attempt to load the service. If the context class loader is null, the [system class loader](../../../java/lang/ClassLoader.html#getSystemClassLoader--) will be used.
* Otherwise, throws a [FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream").
Note that this is a new method that replaces the deprecated[newInstance(String factoryId, ClassLoader classLoader)](../../../javax/xml/stream/XMLEventFactory.html#newInstance-java.lang.String-java.lang.ClassLoader-) method. No changes in behavior are defined by this replacement method relative to the deprecated method.
API Note:
The parameter factoryId defined here is inconsistent with that of other JAXP factories where the first parameter is fully qualified factory class name that provides implementation of the factory.
Parameters:
`factoryId` \- Name of the factory to find, same as a property name
`classLoader` \- classLoader to use
Returns:
the factory implementation
Throws:
`[FactoryConfigurationError](../../../javax/xml/stream/FactoryConfigurationError.html "class in javax.xml.stream")` \- in case of [service configuration error](../../../java/util/ServiceConfigurationError.html "class in java.util") or if the implementation is not available or cannot be instantiated.
* #### setLocation
public abstract void setLocation([Location](../../../javax/xml/stream/Location.html "interface in javax.xml.stream") location)
This method allows setting of the Location on each event that is created by this factory. The values are copied by value into the events created by this factory. To reset the location information set the location to null.
Parameters:
`location` \- the location to set on each event created
* #### createAttribute
public abstract [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events") createAttribute([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceURI,
[String](../../../java/lang/String.html "class in java.lang") localName,
[String](../../../java/lang/String.html "class in java.lang") value)
Create a new Attribute
Parameters:
`prefix` \- the prefix of this attribute, may not be null
`namespaceURI` \- the attribute value is set to this value, may not be null
`localName` \- the local name of the XML name of the attribute, localName cannot be null
`value` \- the attribute value to set, may not be null
Returns:
the Attribute with specified values
* #### createAttribute
public abstract [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events") createAttribute([String](../../../java/lang/String.html "class in java.lang") localName,
[String](../../../java/lang/String.html "class in java.lang") value)
Create a new Attribute
Parameters:
`localName` \- the local name of the XML name of the attribute, localName cannot be null
`value` \- the attribute value to set, may not be null
Returns:
the Attribute with specified values
* #### createAttribute
public abstract [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events") createAttribute([QName](../../../javax/xml/namespace/QName.html "class in javax.xml.namespace") name,
[String](../../../java/lang/String.html "class in java.lang") value)
Create a new Attribute
Parameters:
`name` \- the qualified name of the attribute, may not be null
`value` \- the attribute value to set, may not be null
Returns:
the Attribute with specified values
* #### createNamespace
public abstract [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events") createNamespace([String](../../../java/lang/String.html "class in java.lang") namespaceURI)
Create a new default Namespace
Parameters:
`namespaceURI` \- the default namespace uri
Returns:
the Namespace with the specified value
* #### createNamespace
public abstract [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events") createNamespace([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri)
Create a new Namespace
Parameters:
`prefix` \- the prefix of this namespace, may not be null
`namespaceUri` \- the attribute value is set to this value, may not be null
Returns:
the Namespace with the specified values
* #### createStartElement
public abstract [StartElement](../../../javax/xml/stream/events/StartElement.html "interface in javax.xml.stream.events") createStartElement([QName](../../../javax/xml/namespace/QName.html "class in javax.xml.namespace") name,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events")> attributes,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events")> namespaces)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.
Parameters:
`name` \- the qualified name of the attribute, may not be null
`attributes` \- an optional unordered set of objects that implement Attribute to add to the new StartElement, may be null
`namespaces` \- an optional unordered set of objects that implement Namespace to add to the new StartElement, may be null
Returns:
an instance of the requested StartElement
* #### createStartElement
public abstract [StartElement](../../../javax/xml/stream/events/StartElement.html "interface in javax.xml.stream.events") createStartElement([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri,
[String](../../../java/lang/String.html "class in java.lang") localName)
Create a new StartElement. This defaults the NamespaceContext to an empty NamespaceContext. Querying this event for its namespaces or attributes will result in an empty iterator being returned.
Parameters:
`namespaceUri` \- the uri of the QName of the new StartElement
`localName` \- the local name of the QName of the new StartElement
`prefix` \- the prefix of the QName of the new StartElement
Returns:
an instance of the requested StartElement
* #### createStartElement
public abstract [StartElement](../../../javax/xml/stream/events/StartElement.html "interface in javax.xml.stream.events") createStartElement([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri,
[String](../../../java/lang/String.html "class in java.lang") localName,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events")> attributes,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events")> namespaces)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.
Parameters:
`namespaceUri` \- the uri of the QName of the new StartElement
`localName` \- the local name of the QName of the new StartElement
`prefix` \- the prefix of the QName of the new StartElement
`attributes` \- an unordered set of objects that implement Attribute to add to the new StartElement
`namespaces` \- an unordered set of objects that implement Namespace to add to the new StartElement
Returns:
an instance of the requested StartElement
* #### createStartElement
public abstract [StartElement](../../../javax/xml/stream/events/StartElement.html "interface in javax.xml.stream.events") createStartElement([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri,
[String](../../../java/lang/String.html "class in java.lang") localName,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Attribute](../../../javax/xml/stream/events/Attribute.html "interface in javax.xml.stream.events")> attributes,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events")> namespaces,
[NamespaceContext](../../../javax/xml/namespace/NamespaceContext.html "interface in javax.xml.namespace") context)
Create a new StartElement. Namespaces can be added to this StartElement by passing in an Iterator that walks over a set of Namespace interfaces. Attributes can be added to this StartElement by passing an iterator that walks over a set of Attribute interfaces.
Parameters:
`namespaceUri` \- the uri of the QName of the new StartElement
`localName` \- the local name of the QName of the new StartElement
`prefix` \- the prefix of the QName of the new StartElement
`attributes` \- an unordered set of objects that implement Attribute to add to the new StartElement, may be null
`namespaces` \- an unordered set of objects that implement Namespace to add to the new StartElement, may be null
`context` \- the namespace context of this element
Returns:
an instance of the requested StartElement
* #### createEndElement
public abstract [EndElement](../../../javax/xml/stream/events/EndElement.html "interface in javax.xml.stream.events") createEndElement([QName](../../../javax/xml/namespace/QName.html "class in javax.xml.namespace") name,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events")> namespaces)
Create a new EndElement
Parameters:
`name` \- the qualified name of the EndElement
`namespaces` \- an optional unordered set of objects that implement Namespace that have gone out of scope, may be null
Returns:
an instance of the requested EndElement
* #### createEndElement
public abstract [EndElement](../../../javax/xml/stream/events/EndElement.html "interface in javax.xml.stream.events") createEndElement([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri,
[String](../../../java/lang/String.html "class in java.lang") localName)
Create a new EndElement
Parameters:
`namespaceUri` \- the uri of the QName of the new StartElement
`localName` \- the local name of the QName of the new StartElement
`prefix` \- the prefix of the QName of the new StartElement
Returns:
an instance of the requested EndElement
* #### createEndElement
public abstract [EndElement](../../../javax/xml/stream/events/EndElement.html "interface in javax.xml.stream.events") createEndElement([String](../../../java/lang/String.html "class in java.lang") prefix,
[String](../../../java/lang/String.html "class in java.lang") namespaceUri,
[String](../../../java/lang/String.html "class in java.lang") localName,
[Iterator](../../../java/util/Iterator.html "interface in java.util")<? extends [Namespace](../../../javax/xml/stream/events/Namespace.html "interface in javax.xml.stream.events")> namespaces)
Create a new EndElement
Parameters:
`namespaceUri` \- the uri of the QName of the new StartElement
`localName` \- the local name of the QName of the new StartElement
`prefix` \- the prefix of the QName of the new StartElement
`namespaces` \- an unordered set of objects that implement Namespace that have gone out of scope, may be null
Returns:
an instance of the requested EndElement
* #### createCharacters
public abstract [Characters](../../../javax/xml/stream/events/Characters.html "interface in javax.xml.stream.events") createCharacters([String](../../../java/lang/String.html "class in java.lang") content)
Create a Characters event, this method does not check if the content is all whitespace. To create a space event use #createSpace(String)
Parameters:
`content` \- the string to create
Returns:
a Characters event
* #### createCData
public abstract [Characters](../../../javax/xml/stream/events/Characters.html "interface in javax.xml.stream.events") createCData([String](../../../java/lang/String.html "class in java.lang") content)
Create a Characters event with the CData flag set to true
Parameters:
`content` \- the string to create
Returns:
a Characters event
* #### createSpace
public abstract [Characters](../../../javax/xml/stream/events/Characters.html "interface in javax.xml.stream.events") createSpace([String](../../../java/lang/String.html "class in java.lang") content)
Create a Characters event with the isSpace flag set to true
Parameters:
`content` \- the content of the space to create
Returns:
a Characters event
* #### createIgnorableSpace
public abstract [Characters](../../../javax/xml/stream/events/Characters.html "interface in javax.xml.stream.events") createIgnorableSpace([String](../../../java/lang/String.html "class in java.lang") content)
Create an ignorable space
Parameters:
`content` \- the space to create
Returns:
a Characters event
* #### createStartDocument
public abstract [StartDocument](../../../javax/xml/stream/events/StartDocument.html "interface in javax.xml.stream.events") createStartDocument()
Creates a new instance of a StartDocument event
Returns:
a StartDocument event
* #### createStartDocument
public abstract [StartDocument](../../../javax/xml/stream/events/StartDocument.html "interface in javax.xml.stream.events") createStartDocument([String](../../../java/lang/String.html "class in java.lang") encoding,
[String](../../../java/lang/String.html "class in java.lang") version,
boolean standalone)
Creates a new instance of a StartDocument event
Parameters:
`encoding` \- the encoding style
`version` \- the XML version
`standalone` \- the status of standalone may be set to "true" or "false"
Returns:
a StartDocument event
* #### createStartDocument
public abstract [StartDocument](../../../javax/xml/stream/events/StartDocument.html "interface in javax.xml.stream.events") createStartDocument([String](../../../java/lang/String.html "class in java.lang") encoding,
[String](../../../java/lang/String.html "class in java.lang") version)
Creates a new instance of a StartDocument event
Parameters:
`encoding` \- the encoding style
`version` \- the XML version
Returns:
a StartDocument event
* #### createStartDocument
public abstract [StartDocument](../../../javax/xml/stream/events/StartDocument.html "interface in javax.xml.stream.events") createStartDocument([String](../../../java/lang/String.html "class in java.lang") encoding)
Creates a new instance of a StartDocument event
Parameters:
`encoding` \- the encoding style
Returns:
a StartDocument event
* #### createEndDocument
public abstract [EndDocument](../../../javax/xml/stream/events/EndDocument.html "interface in javax.xml.stream.events") createEndDocument()
Creates a new instance of an EndDocument event
Returns:
an EndDocument event
* #### createEntityReference
public abstract [EntityReference](../../../javax/xml/stream/events/EntityReference.html "interface in javax.xml.stream.events") createEntityReference([String](../../../java/lang/String.html "class in java.lang") name,
[EntityDeclaration](../../../javax/xml/stream/events/EntityDeclaration.html "interface in javax.xml.stream.events") declaration)
Creates a new instance of a EntityReference event
Parameters:
`name` \- The name of the reference
`declaration` \- the declaration for the event
Returns:
an EntityReference event
* #### createComment
public abstract [Comment](../../../javax/xml/stream/events/Comment.html "interface in javax.xml.stream.events") createComment([String](../../../java/lang/String.html "class in java.lang") text)
Create a comment
Parameters:
`text` \- The text of the comment a Comment event
* #### createProcessingInstruction
public abstract [ProcessingInstruction](../../../javax/xml/stream/events/ProcessingInstruction.html "interface in javax.xml.stream.events") createProcessingInstruction([String](../../../java/lang/String.html "class in java.lang") target,
[String](../../../java/lang/String.html "class in java.lang") data)
Create a processing instruction
Parameters:
`target` \- The target of the processing instruction
`data` \- The text of the processing instruction
Returns:
a ProcessingInstruction event
* #### createDTD
public abstract [DTD](../../../javax/xml/stream/events/DTD.html "interface in javax.xml.stream.events") createDTD([String](../../../java/lang/String.html "class in java.lang") dtd)
Create a document type definition event This string contains the entire document type declaration that matches the doctypedecl in the XML 1.0 specification
Parameters:
`dtd` \- the text of the document type definition
Returns:
a DTD event