- java.lang.Object
-
- javax.xml.stream.XMLEventFactory
-
- com.sun.xml.fastinfoset.stax.factory.StAXEventFactory
-
public class StAXEventFactory extends XMLEventFactory
-
-
Constructor Summary
Constructors Constructor Description StAXEventFactory()
Creates a new instance of StAXEventFactory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Attribute
createAttribute(String localName, String value)
Create a new AttributeAttribute
createAttribute(String prefix, String namespaceURI, String localName, String value)
Create a new AttributeAttribute
createAttribute(QName name, String value)
Characters
createCData(String content)
Create a Characters event with the CData flag set to trueCharacters
createCharacters(String content)
Create a Characters event, this method does not check if the content is all whitespace.Comment
createComment(String text)
Create a commentDTD
createDTD(String dtd)
Create a document type definition event This string contains the entire document type declaration that matches the doctypedecl in the XML 1.0 specificationEndDocument
createEndDocument()
EndElement
createEndElement(String prefix, String namespaceUri, String localName)
Create a new EndElementEndElement
createEndElement(String prefix, String namespaceUri, String localName, Iterator namespaces)
Create a new EndElementEndElement
createEndElement(QName name, Iterator namespaces)
Create a new EndElementEntityReference
createEntityReference(String name, EntityDeclaration entityDeclaration)
Creates a new instance of a EntityReference eventCharacters
createIgnorableSpace(String content)
Create an ignorable spaceNamespace
createNamespace(String namespaceURI)
Create a new default NamespaceNamespace
createNamespace(String prefix, String namespaceURI)
Create a new NamespaceProcessingInstruction
createProcessingInstruction(String target, String data)
Create a processing instructionCharacters
createSpace(String content)
Create a Characters event with the isSpace flag set to trueStartDocument
createStartDocument()
Creates a new instance of a StartDocument eventStartDocument
createStartDocument(String encoding)
Creates a new instance of a StartDocument eventStartDocument
createStartDocument(String encoding, String version)
Creates a new instance of a StartDocument eventStartDocument
createStartDocument(String encoding, String version, boolean standalone)
Creates a new instance of a StartDocument eventStartElement
createStartElement(String prefix, String namespaceUri, String localName)
StartElement
createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces)
StartElement
createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context)
StartElement
createStartElement(QName name, Iterator attributes, Iterator namespaces)
Create a new StartElement.void
setLocation(Location location)
This method allows setting of the Location on each event that is created by this factory.-
Methods inherited from class javax.xml.stream.XMLEventFactory
newDefaultFactory, newFactory, newFactory, newInstance, newInstance
-
-
-
-
Method Detail
-
setLocation
public void setLocation(Location 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.- Specified by:
setLocation
in classXMLEventFactory
- Parameters:
location
- the location to set on each event created
-
createAttribute
public Attribute createAttribute(String prefix, String namespaceURI, String localName, String value)
Create a new Attribute- Specified by:
createAttribute
in classXMLEventFactory
- Parameters:
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 null- Returns:
- the Attribute with specified values
-
createAttribute
public Attribute createAttribute(String localName, String value)
Create a new Attribute- Specified by:
createAttribute
in classXMLEventFactory
- Parameters:
localName
- the local name of the XML name of the attribute, localName cannot be nullvalue
- the attribute value to set, may not be null- Returns:
- the Attribute with specified values
-
createAttribute
public Attribute createAttribute(QName name, String value)
- Specified by:
createAttribute
in classXMLEventFactory
-
createNamespace
public Namespace createNamespace(String namespaceURI)
Create a new default Namespace- Specified by:
createNamespace
in classXMLEventFactory
- Parameters:
namespaceURI
- the default namespace uri- Returns:
- the Namespace with the specified value
-
createNamespace
public Namespace createNamespace(String prefix, String namespaceURI)
Create a new Namespace- Specified by:
createNamespace
in classXMLEventFactory
- Parameters:
prefix
- the prefix of this namespace, may not be nullnamespaceURI
- the attribute value is set to this value, may not be null- Returns:
- the Namespace with the specified values
-
createStartElement
public StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces)
Create a new StartElement.- Specified by:
createStartElement
in classXMLEventFactory
- Parameters:
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 null- Returns:
- an instance of the requested StartElement
-
createStartElement
public StartElement createStartElement(String prefix, String namespaceUri, String localName)
- Specified by:
createStartElement
in classXMLEventFactory
-
createStartElement
public StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces)
- Specified by:
createStartElement
in classXMLEventFactory
-
createStartElement
public StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context)
- Specified by:
createStartElement
in classXMLEventFactory
-
createEndElement
public EndElement createEndElement(QName name, Iterator namespaces)
Create a new EndElement- Specified by:
createEndElement
in classXMLEventFactory
- Parameters:
name
- the qualified name of the EndElementnamespaces
- 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 EndElement createEndElement(String prefix, String namespaceUri, String localName)
Create a new EndElement- Specified by:
createEndElement
in classXMLEventFactory
- Parameters:
namespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementprefix
- the prefix of the QName of the new StartElement- Returns:
- an instance of the requested EndElement
-
createEndElement
public EndElement createEndElement(String prefix, String namespaceUri, String localName, Iterator namespaces)
Create a new EndElement- Specified by:
createEndElement
in classXMLEventFactory
- Parameters:
namespaceUri
- the uri of the QName of the new StartElementlocalName
- the local name of the QName of the new StartElementprefix
- the prefix of the QName of the new StartElementnamespaces
- 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 Characters createCharacters(String content)
Create a Characters event, this method does not check if the content is all whitespace. To create a space event use #createSpace(String)- Specified by:
createCharacters
in classXMLEventFactory
- Parameters:
content
- the string to create- Returns:
- a Characters event
-
createCData
public Characters createCData(String content)
Create a Characters event with the CData flag set to true- Specified by:
createCData
in classXMLEventFactory
- Parameters:
content
- the string to create- Returns:
- a Characters event
-
createSpace
public Characters createSpace(String content)
Create a Characters event with the isSpace flag set to true- Specified by:
createSpace
in classXMLEventFactory
- Parameters:
content
- the content of the space to create- Returns:
- a Characters event
-
createIgnorableSpace
public Characters createIgnorableSpace(String content)
Create an ignorable space- Specified by:
createIgnorableSpace
in classXMLEventFactory
- Parameters:
content
- the space to create- Returns:
- a Characters event
-
createStartDocument
public StartDocument createStartDocument()
Creates a new instance of a StartDocument event- Specified by:
createStartDocument
in classXMLEventFactory
- Returns:
- a StartDocument event
-
createStartDocument
public StartDocument createStartDocument(String encoding)
Creates a new instance of a StartDocument event- Specified by:
createStartDocument
in classXMLEventFactory
- Parameters:
encoding
- the encoding style- Returns:
- a StartDocument event
-
createStartDocument
public StartDocument createStartDocument(String encoding, String version)
Creates a new instance of a StartDocument event- Specified by:
createStartDocument
in classXMLEventFactory
- Parameters:
encoding
- the encoding styleversion
- the XML version- Returns:
- a StartDocument event
-
createStartDocument
public StartDocument createStartDocument(String encoding, String version, boolean standalone)
Creates a new instance of a StartDocument event- Specified by:
createStartDocument
in classXMLEventFactory
- Parameters:
encoding
- the encoding styleversion
- the XML versionstandalone
- the status of standalone may be set to "true" or "false"- Returns:
- a StartDocument event
-
createEndDocument
public EndDocument createEndDocument()
- Specified by:
createEndDocument
in classXMLEventFactory
-
createEntityReference
public EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration)
Creates a new instance of a EntityReference event- Specified by:
createEntityReference
in classXMLEventFactory
- Parameters:
name
- The name of the referenceentityDeclaration
- the declaration for the event- Returns:
- an EntityReference event
-
createComment
public Comment createComment(String text)
Create a comment- Specified by:
createComment
in classXMLEventFactory
- Parameters:
text
- The text of the comment a Comment event
-
createDTD
public DTD createDTD(String 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- Specified by:
createDTD
in classXMLEventFactory
- Parameters:
dtd
- the text of the document type definition- Returns:
- a DTD event
-
createProcessingInstruction
public ProcessingInstruction createProcessingInstruction(String target, String data)
Create a processing instruction- Specified by:
createProcessingInstruction
in classXMLEventFactory
- Parameters:
target
- The target of the processing instructiondata
- The text of the processing instruction- Returns:
- a ProcessingInstruction event
-
-