Top Description Fields Constructors Methods
org.codehaus.stax2.ri

public abstract Class Stax2EventFactoryImpl

extends XMLEventFactory2
Class Inheritance
Imports
java.util.Iterator, javax.xml.namespace.NamespaceContext, .QName, javax.xml.stream.*, javax.xml.stream.events.*, org.codehaus.stax2.evt.XMLEventFactory2, .DTD2, org.codehaus.stax2.ri.evt.*

This is an abstract almost complete plain vanilla implementation of XMLEventFactory2. It can be used as a building block for concrete implementations: the minimal requirement is to implement createQName methods.

Note that due to underlying Stax factory being non-generic (it was specified for JDK 1.4, pre-generic), no generic typing can be added to various java.util.Iterators in signatures.

Author
Tatu Saloranta
Since
3.0

Field Summary

Modifier and TypeField and Description
protected Location

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Attribute
createAttribute(QName
the qualified name of the attribute, may not be null
name
,
String
the attribute value to set, may not be null
value
)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute
public Attribute
createAttribute(String
the local name of the XML name of the attribute, localName cannot be null
localName
,
String
the attribute value to set, may not be null
value
)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute
public Attribute
createAttribute(String
the prefix of this attribute, may not be null
prefix
,
String
the attribute value is set to this value, may not be null
nsURI
,
String
the local name of the XML name of the attribute, localName cannot be null
localName
,
String
the attribute value to set, may not be null
value
)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute
public Characters
createCData(String
the string to create
content
)

Implements abstract javax.xml.stream.XMLEventFactory.createCData.

Create a Characters event with the CData flag set to true
public Characters
createCharacters(String
the string to create
content
)

Implements abstract javax.xml.stream.XMLEventFactory.createCharacters.

Create a Characters event, this method does not check if the content is all whitespace.
public Comment
createComment(String
The text of the comment
text
)

Implements abstract javax.xml.stream.XMLEventFactory.createComment.

Create a comment.
public DTD
createDTD(String
the text of the document type definition
dtd
)

Implements abstract javax.xml.stream.XMLEventFactory.createDTD.

Note

constructing DTD events this way means that there will be no internal presentation of actual DTD; no parsing is implied by construction.

public DTD2
createDTD(String rootName, String sysId, String pubId, String intSubset)

Implements abstract org.codehaus.stax2.evt.XMLEventFactory2.createDTD.

public DTD2
createDTD(String rootName, String sysId, String pubId, String intSubset, Object processedDTD)

Implements abstract org.codehaus.stax2.evt.XMLEventFactory2.createDTD.

public EndDocument
createEndDocument()

Implements abstract javax.xml.stream.XMLEventFactory.createEndDocument.

Creates a new instance of an EndDocument event
public EndElement
createEndElement(QName
the qualified name of the EndElement
name
,
Iterator<E>
an optional unordered set of objects that implement Namespace that have gone out of scope, may be null
namespaces
)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement
public EndElement
createEndElement(String
the prefix of the QName of the new StartElement
prefix
,
String
the uri of the QName of the new StartElement
nsURI
,
String
the local name of the QName of the new StartElement
localName
)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement
public EndElement
createEndElement(String
the prefix of the QName of the new StartElement
prefix
,
String
the uri of the QName of the new StartElement
nsURI
,
String
the local name of the QName of the new StartElement
localName
,
Iterator<E>
an unordered set of objects that implement Namespace that have gone out of scope, may be null
ns
)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement
public EntityReference
createEntityReference(String
The name of the reference
name
,
EntityDeclaration
the declaration for the event
decl
)

Implements abstract javax.xml.stream.XMLEventFactory.createEntityReference.

Creates a new instance of a EntityReference event
public Characters
createIgnorableSpace(String
the space to create
content
)

Implements abstract javax.xml.stream.XMLEventFactory.createIgnorableSpace.

Create an ignorable space
public Namespace
createNamespace(String
the default namespace uri
nsURI
)

Implements abstract javax.xml.stream.XMLEventFactory.createNamespace.

Create a new default Namespace
public Namespace
createNamespace(String
the prefix of this namespace, may not be null
prefix
,
String
the attribute value is set to this value, may not be null
nsURI
)

Implements abstract javax.xml.stream.XMLEventFactory.createNamespace.

Create a new Namespace
public ProcessingInstruction
createProcessingInstruction(String
The target of the processing instruction
target
,
String
The text of the processing instruction
data
)

Implements abstract javax.xml.stream.XMLEventFactory.createProcessingInstruction.

Create a processing instruction
protected abstract QName
createQName(String nsURI, String localName)

protected abstract QName
createQName(String nsURI, String localName, String prefix)

public Characters
createSpace(String
the content of the space to create
content
)

Implements abstract javax.xml.stream.XMLEventFactory.createSpace.

Create a Characters event with the isSpace flag set to true
public StartDocument
createStartDocument()

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event
public StartDocument
createStartDocument(String
the encoding style
encoding
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event
public StartDocument
createStartDocument(String
the encoding style
encoding
,
String
the XML version
version
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event
public StartDocument
createStartDocument(String
the encoding style
encoding
,
String
the XML version
version
,
boolean
the status of standalone may be set to "true" or "false"
standalone
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event
public StartElement
createStartElement(QName
the qualified name of the attribute, may not be null
name
,
Iterator<E>
an optional unordered set of objects that implement Attribute to add to the new StartElement, may be null
attr
,
Iterator<E>
an optional unordered set of objects that implement Namespace to add to the new StartElement, may be null
ns
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Create a new StartElement.
public StartElement
createStartElement(String
the prefix of the QName of the new StartElement
prefix
,
String
the uri of the QName of the new StartElement
nsURI
,
String
the local name of the QName of the new StartElement
localName
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Create a new StartElement.
public StartElement
createStartElement(String
the prefix of the QName of the new StartElement
prefix
,
String
the uri of the QName of the new StartElement
nsURI
,
String
the local name of the QName of the new StartElement
localName
,
Iterator<E>
an unordered set of objects that implement Attribute to add to the new StartElement
attr
,
Iterator<E>
an unordered set of objects that implement Namespace to add to the new StartElement
ns
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Create a new StartElement.
public StartElement
createStartElement(String
the prefix of the QName of the new StartElement
prefix
,
String
the uri of the QName of the new StartElement
nsURI
,
String
the local name of the QName of the new StartElement
localName
,
Iterator<E>
an unordered set of objects that implement Attribute to add to the new StartElement, may be null
attr
,
Iterator<E>
an unordered set of objects that implement Namespace to add to the new StartElement, may be null
ns
,
NamespaceContext
the namespace context of this element
nsCtxt
)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Create a new StartElement.
protected StartElement
public void
setLocation(Location
the location to set on each event created
loc
)

Implements abstract javax.xml.stream.XMLEventFactory.setLocation.

This method allows setting of the Location on each event that is created by this factory.

Field Detail

mLocationback to summary
protected Location mLocation

Constructor Detail

Stax2EventFactoryImplback to summary
public Stax2EventFactoryImpl()

Method Detail

createAttributeback to summary
public Attribute createAttribute(QName name, String value)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Doc from javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute

Parameters
name:QName

the qualified name of the attribute, may not be null

value:String

the attribute value to set, may not be null

Returns:Attribute

the Attribute with specified values

Annotations
@Override
createAttributeback to summary
public Attribute createAttribute(String localName, String value)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Doc from javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute

Parameters
localName:String

the local name of the XML name of the attribute, localName cannot be null

value:String

the attribute value to set, may not be null

Returns:Attribute

the Attribute with specified values

Annotations
@Override
createAttributeback to summary
public Attribute createAttribute(String prefix, String nsURI, String localName, String value)

Implements abstract javax.xml.stream.XMLEventFactory.createAttribute.

Doc from javax.xml.stream.XMLEventFactory.createAttribute.

Create a new Attribute

Parameters
prefix:String

the prefix of this attribute, may not be null

nsURI:String

the attribute value is set to this value, may not be null

localName:String

the local name of the XML name of the attribute, localName cannot be null

value:String

the attribute value to set, may not be null

Returns:Attribute

the Attribute with specified values

Annotations
@Override
createCDataback to summary
public Characters createCData(String content)

Implements abstract javax.xml.stream.XMLEventFactory.createCData.

Doc from javax.xml.stream.XMLEventFactory.createCData.

Create a Characters event with the CData flag set to true

Parameters
content:String

the string to create

Returns:Characters

a Characters event

Annotations
@Override
createCharactersback to summary
public Characters createCharacters(String content)

Implements abstract javax.xml.stream.XMLEventFactory.createCharacters.

Doc from javax.xml.stream.XMLEventFactory.createCharacters.

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:String

the string to create

Returns:Characters

a Characters event

Annotations
@Override
createCommentback to summary
public Comment createComment(String text)

Implements abstract javax.xml.stream.XMLEventFactory.createComment.

Doc from javax.xml.stream.XMLEventFactory.createComment.

Create a comment.

Parameters
text:String

The text of the comment

Returns:Comment

a Comment event

Annotations
@Override
createDTDback to summary
public DTD createDTD(String dtd)

Implements abstract javax.xml.stream.XMLEventFactory.createDTD.

Note

constructing DTD events this way means that there will be no internal presentation of actual DTD; no parsing is implied by construction.

Parameters
dtd:String

Doc from javax.xml.stream.XMLEventFactory.createDTD.

the text of the document type definition

Returns:DTD

Doc from javax.xml.stream.XMLEventFactory.createDTD.

a DTD event

Annotations
@Override
createDTDback to summary
public DTD2 createDTD(String rootName, String sysId, String pubId, String intSubset)

Implements abstract org.codehaus.stax2.evt.XMLEventFactory2.createDTD.

Annotations
@Override
createDTDback to summary
public DTD2 createDTD(String rootName, String sysId, String pubId, String intSubset, Object processedDTD)

Implements abstract org.codehaus.stax2.evt.XMLEventFactory2.createDTD.

Annotations
@Override
createEndDocumentback to summary
public EndDocument createEndDocument()

Implements abstract javax.xml.stream.XMLEventFactory.createEndDocument.

Doc from javax.xml.stream.XMLEventFactory.createEndDocument.

Creates a new instance of an EndDocument event

Returns:EndDocument

an EndDocument event

Annotations
@Override
createEndElementback to summary
public EndElement createEndElement(QName name, Iterator<E> namespaces)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Doc from javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement

Parameters
name:QName

the qualified name of the EndElement

namespaces:Iterator<E>

an optional unordered set of objects that implement Namespace that have gone out of scope, may be null

Returns:EndElement

an instance of the requested EndElement

Annotations
@SuppressWarnings:rawtypes, unchecked
@Override
createEndElementback to summary
public EndElement createEndElement(String prefix, String nsURI, String localName)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Doc from javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement

Parameters
prefix:String

the prefix of the QName of the new StartElement

nsURI:String

the uri of the QName of the new StartElement

localName:String

the local name of the QName of the new StartElement

Returns:EndElement

an instance of the requested EndElement

Annotations
@Override
createEndElementback to summary
public EndElement createEndElement(String prefix, String nsURI, String localName, Iterator<E> ns)

Implements abstract javax.xml.stream.XMLEventFactory.createEndElement.

Doc from javax.xml.stream.XMLEventFactory.createEndElement.

Create a new EndElement

Parameters
prefix:String

the prefix of the QName of the new StartElement

nsURI:String

the uri of the QName of the new StartElement

localName:String

the local name of the QName of the new StartElement

ns:Iterator<E>

an unordered set of objects that implement Namespace that have gone out of scope, may be null

Returns:EndElement

an instance of the requested EndElement

Annotations
@SuppressWarnings:rawtypes
@Override
createEntityReferenceback to summary
public EntityReference createEntityReference(String name, EntityDeclaration decl)

Implements abstract javax.xml.stream.XMLEventFactory.createEntityReference.

Doc from javax.xml.stream.XMLEventFactory.createEntityReference.

Creates a new instance of a EntityReference event

Parameters
name:String

The name of the reference

decl:EntityDeclaration

the declaration for the event

Returns:EntityReference

an EntityReference event

Annotations
@Override
createIgnorableSpaceback to summary
public Characters createIgnorableSpace(String content)

Implements abstract javax.xml.stream.XMLEventFactory.createIgnorableSpace.

Doc from javax.xml.stream.XMLEventFactory.createIgnorableSpace.

Create an ignorable space

Parameters
content:String

the space to create

Returns:Characters

a Characters event

Annotations
@Override
createNamespaceback to summary
public Namespace createNamespace(String nsURI)

Implements abstract javax.xml.stream.XMLEventFactory.createNamespace.

Doc from javax.xml.stream.XMLEventFactory.createNamespace.

Create a new default Namespace

Parameters
nsURI:String

the default namespace uri

Returns:Namespace

the Namespace with the specified value

Annotations
@Override
createNamespaceback to summary
public Namespace createNamespace(String prefix, String nsURI)

Implements abstract javax.xml.stream.XMLEventFactory.createNamespace.

Doc from javax.xml.stream.XMLEventFactory.createNamespace.

Create a new Namespace

Parameters
prefix:String

the prefix of this namespace, may not be null

nsURI:String

the attribute value is set to this value, may not be null

Returns:Namespace

the Namespace with the specified values

Annotations
@Override
createProcessingInstructionback to summary
public ProcessingInstruction createProcessingInstruction(String target, String data)

Implements abstract javax.xml.stream.XMLEventFactory.createProcessingInstruction.

Doc from javax.xml.stream.XMLEventFactory.createProcessingInstruction.

Create a processing instruction

Parameters
target:String

The target of the processing instruction

data:String

The text of the processing instruction

Returns:ProcessingInstruction

a ProcessingInstruction event

Annotations
@Override
createQNameback to summary
protected abstract QName createQName(String nsURI, String localName)
createQNameback to summary
protected abstract QName createQName(String nsURI, String localName, String prefix)
createSpaceback to summary
public Characters createSpace(String content)

Implements abstract javax.xml.stream.XMLEventFactory.createSpace.

Doc from javax.xml.stream.XMLEventFactory.createSpace.

Create a Characters event with the isSpace flag set to true

Parameters
content:String

the content of the space to create

Returns:Characters

a Characters event

Annotations
@Override
createStartDocumentback to summary
public StartDocument createStartDocument()

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Doc from javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event

Returns:StartDocument

a StartDocument event

Annotations
@Override
createStartDocumentback to summary
public StartDocument createStartDocument(String encoding)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Doc from javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event

Parameters
encoding:String

the encoding style

Returns:StartDocument

a StartDocument event

Annotations
@Override
createStartDocumentback to summary
public StartDocument createStartDocument(String encoding, String version)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Doc from javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event

Parameters
encoding:String

the encoding style

version:String

the XML version

Returns:StartDocument

a StartDocument event

Annotations
@Override
createStartDocumentback to summary
public StartDocument createStartDocument(String encoding, String version, boolean standalone)

Implements abstract javax.xml.stream.XMLEventFactory.createStartDocument.

Doc from javax.xml.stream.XMLEventFactory.createStartDocument.

Creates a new instance of a StartDocument event

Parameters
encoding:String

the encoding style

version:String

the XML version

standalone:boolean

the status of standalone may be set to "true" or "false"

Returns:StartDocument

a StartDocument event

Annotations
@Override
createStartElementback to summary
public StartElement createStartElement(QName name, Iterator<E> attr, Iterator<E> ns)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Doc from javax.xml.stream.XMLEventFactory.createStartElement.

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:QName

the qualified name of the attribute, may not be null

attr:Iterator<E>

an optional unordered set of objects that implement Attribute to add to the new StartElement, may be null

ns:Iterator<E>

an optional unordered set of objects that implement Namespace to add to the new StartElement, may be null

Returns:StartElement

an instance of the requested StartElement

Annotations
@SuppressWarnings:rawtypes
@Override
createStartElementback to summary
public StartElement createStartElement(String prefix, String nsURI, String localName)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Doc from javax.xml.stream.XMLEventFactory.createStartElement.

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
prefix:String

the prefix of the QName of the new StartElement

nsURI:String

the uri of the QName of the new StartElement

localName:String

the local name of the QName of the new StartElement

Returns:StartElement

an instance of the requested StartElement

Annotations
@Override
createStartElementback to summary
public StartElement createStartElement(String prefix, String nsURI, String localName, Iterator<E> attr, Iterator<E> ns)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Doc from javax.xml.stream.XMLEventFactory.createStartElement.

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
prefix:String

the prefix of the QName of the new StartElement

nsURI:String

the uri of the QName of the new StartElement

localName:String

the local name of the QName of the new StartElement

attr:Iterator<E>

an unordered set of objects that implement Attribute to add to the new StartElement

ns:Iterator<E>

an unordered set of objects that implement Namespace to add to the new StartElement

Returns:StartElement

an instance of the requested StartElement

Annotations
@SuppressWarnings:rawtypes
@Override
createStartElementback to summary
public StartElement createStartElement(String prefix, String nsURI, String localName, Iterator<E> attr, Iterator<E> ns, NamespaceContext nsCtxt)

Implements abstract javax.xml.stream.XMLEventFactory.createStartElement.

Doc from javax.xml.stream.XMLEventFactory.createStartElement.

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
prefix:String

the prefix of the QName of the new StartElement

nsURI:String

the uri of the QName of the new StartElement

localName:String

the local name of the QName of the new StartElement

attr:Iterator<E>

an unordered set of objects that implement Attribute to add to the new StartElement, may be null

ns:Iterator<E>

an unordered set of objects that implement Namespace to add to the new StartElement, may be null

nsCtxt:NamespaceContext

the namespace context of this element

Returns:StartElement

an instance of the requested StartElement

Annotations
@SuppressWarnings:rawtypes
@Override
createStartElementback to summary
protected StartElement createStartElement(QName name, Iterator<?> attr, Iterator<?> ns, NamespaceContext ctxt)
setLocationback to summary
public void setLocation(Location loc)

Implements abstract javax.xml.stream.XMLEventFactory.setLocation.

Doc from javax.xml.stream.XMLEventFactory.setLocation.

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
loc:Location

the location to set on each event created

Annotations
@Override