FileDocCategorySizeDatePackage
XMLEventFactory.javaAPI DocJava SE 6 API13225Tue Jun 10 00:27:10 BST 2008javax.xml.stream

XMLEventFactory

public abstract class XMLEventFactory extends Object
This interface defines a utility class for creating instances of XMLEvents
version
1.0
author
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
see
javax.xml.stream.events.StartElement
see
javax.xml.stream.events.EndElement
see
javax.xml.stream.events.ProcessingInstruction
see
javax.xml.stream.events.Comment
see
javax.xml.stream.events.Characters
see
javax.xml.stream.events.StartDocument
see
javax.xml.stream.events.EndDocument
see
javax.xml.stream.events.DTD
since
1.6

Fields Summary
Constructors Summary
protected XMLEventFactory()

Methods Summary
public abstract javax.xml.stream.events.AttributecreateAttribute(java.lang.String prefix, java.lang.String namespaceURI, java.lang.String localName, java.lang.String value)
Create a new Attribute

param
prefix the prefix of this attribute, may not be null
param
namespaceURI the attribute value is set to this value, may not be null
param
localName the local name of the XML name of the attribute, localName cannot be null
param
value the attribute value to set, may not be null
return
the Attribute with specified values

public abstract javax.xml.stream.events.AttributecreateAttribute(java.lang.String localName, java.lang.String value)
Create a new Attribute

param
localName the local name of the XML name of the attribute, localName cannot be null
param
value the attribute value to set, may not be null
return
the Attribute with specified values

public abstract javax.xml.stream.events.AttributecreateAttribute(javax.xml.namespace.QName name, java.lang.String value)
Create a new Attribute

param
name the qualified name of the attribute, may not be null
param
value the attribute value to set, may not be null
return
the Attribute with specified values

public abstract javax.xml.stream.events.CharacterscreateCData(java.lang.String content)
Create a Characters event with the CData flag set to true

param
content the string to create
return
a Characters event

public abstract javax.xml.stream.events.CharacterscreateCharacters(java.lang.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)

param
content the string to create
return
a Characters event

public abstract javax.xml.stream.events.CommentcreateComment(java.lang.String text)
Create a comment

param
text The text of the comment a Comment event

public abstract javax.xml.stream.events.DTDcreateDTD(java.lang.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

param
dtd the text of the document type definition
return
a DTD event

public abstract javax.xml.stream.events.EndDocumentcreateEndDocument()
Creates a new instance of an EndDocument event

return
an EndDocument event

public abstract javax.xml.stream.events.EndElementcreateEndElement(javax.xml.namespace.QName name, java.util.Iterator namespaces)
Create a new EndElement

param
name the qualified name of the EndElement
param
namespaces an optional unordered set of objects that implement Namespace that have gone out of scope, may be null
return
an instance of the requested EndElement

public abstract javax.xml.stream.events.EndElementcreateEndElement(java.lang.String prefix, java.lang.String namespaceUri, java.lang.String localName)
Create a new EndElement

param
namespaceUri the uri of the QName of the new StartElement
param
localName the local name of the QName of the new StartElement
param
prefix the prefix of the QName of the new StartElement
return
an instance of the requested EndElement

public abstract javax.xml.stream.events.EndElementcreateEndElement(java.lang.String prefix, java.lang.String namespaceUri, java.lang.String localName, java.util.Iterator namespaces)
Create a new EndElement

param
namespaceUri the uri of the QName of the new StartElement
param
localName the local name of the QName of the new StartElement
param
prefix the prefix of the QName of the new StartElement
param
namespaces an unordered set of objects that implement Namespace that have gone out of scope, may be null
return
an instance of the requested EndElement

public abstract javax.xml.stream.events.EntityReferencecreateEntityReference(java.lang.String name, javax.xml.stream.events.EntityDeclaration declaration)
Creates a new instance of a EntityReference event

param
name The name of the reference
param
declaration the declaration for the event
return
an EntityReference event

public abstract javax.xml.stream.events.CharacterscreateIgnorableSpace(java.lang.String content)
Create an ignorable space

param
content the space to create
return
a Characters event

public abstract javax.xml.stream.events.NamespacecreateNamespace(java.lang.String namespaceURI)
Create a new default Namespace

param
namespaceURI the default namespace uri
return
the Namespace with the specified value

public abstract javax.xml.stream.events.NamespacecreateNamespace(java.lang.String prefix, java.lang.String namespaceUri)
Create a new Namespace

param
prefix the prefix of this namespace, may not be null
param
namespaceUri the attribute value is set to this value, may not be null
return
the Namespace with the specified values

public abstract javax.xml.stream.events.ProcessingInstructioncreateProcessingInstruction(java.lang.String target, java.lang.String data)
Create a processing instruction

param
target The target of the processing instruction
param
data The text of the processing instruction
return
a ProcessingInstruction event

public abstract javax.xml.stream.events.CharacterscreateSpace(java.lang.String content)
Create a Characters event with the isSpace flag set to true

param
content the content of the space to create
return
a Characters event

public abstract javax.xml.stream.events.StartDocumentcreateStartDocument()
Creates a new instance of a StartDocument event

return
a StartDocument event

public abstract javax.xml.stream.events.StartDocumentcreateStartDocument(java.lang.String encoding, java.lang.String version, boolean standalone)
Creates a new instance of a StartDocument event

param
encoding the encoding style
param
version the XML version
param
standalone the status of standalone may be set to "true" or "false"
return
a StartDocument event

public abstract javax.xml.stream.events.StartDocumentcreateStartDocument(java.lang.String encoding, java.lang.String version)
Creates a new instance of a StartDocument event

param
encoding the encoding style
param
version the XML version
return
a StartDocument event

public abstract javax.xml.stream.events.StartDocumentcreateStartDocument(java.lang.String encoding)
Creates a new instance of a StartDocument event

param
encoding the encoding style
return
a StartDocument event

public abstract javax.xml.stream.events.StartElementcreateStartElement(javax.xml.namespace.QName name, java.util.Iterator attributes, java.util.Iterator 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.

param
name the qualified name of the attribute, may not be null
param
attributes an optional unordered set of objects that implement Attribute to add to the new StartElement, may be null
param
namespaces an optional unordered set of objects that implement Namespace to add to the new StartElement, may be null
return
an instance of the requested StartElement

public abstract javax.xml.stream.events.StartElementcreateStartElement(java.lang.String prefix, java.lang.String namespaceUri, java.lang.String 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.

param
namespaceUri the uri of the QName of the new StartElement
param
localName the local name of the QName of the new StartElement
param
prefix the prefix of the QName of the new StartElement
return
an instance of the requested StartElement

public abstract javax.xml.stream.events.StartElementcreateStartElement(java.lang.String prefix, java.lang.String namespaceUri, java.lang.String localName, java.util.Iterator attributes, java.util.Iterator 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.

param
namespaceUri the uri of the QName of the new StartElement
param
localName the local name of the QName of the new StartElement
param
prefix the prefix of the QName of the new StartElement
param
attributes an unordered set of objects that implement Attribute to add to the new StartElement
param
namespaces an unordered set of objects that implement Namespace to add to the new StartElement
return
an instance of the requested StartElement

public abstract javax.xml.stream.events.StartElementcreateStartElement(java.lang.String prefix, java.lang.String namespaceUri, java.lang.String localName, java.util.Iterator attributes, java.util.Iterator namespaces, javax.xml.namespace.NamespaceContext 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.

param
namespaceUri the uri of the QName of the new StartElement
param
localName the local name of the QName of the new StartElement
param
prefix the prefix of the QName of the new StartElement
param
attributes an unordered set of objects that implement Attribute to add to the new StartElement, may be null
param
namespaces an unordered set of objects that implement Namespace to add to the new StartElement, may be null
param
context the namespace context of this element
return
an instance of the requested StartElement

public static javax.xml.stream.XMLEventFactorynewInstance()
Create a new instance of the factory

throws
FactoryConfigurationError if an instance of this factory cannot be loaded

    return (XMLEventFactory) FactoryFinder.find(
      "javax.xml.stream.XMLEventFactory",
      "com.sun.xml.internal.stream.events.XMLEventFactoryImpl");
  
public static javax.xml.stream.XMLEventFactorynewInstance(java.lang.String factoryId, java.lang.ClassLoader classLoader)
Create a new instance of the factory

param
factoryId Name of the factory to find, same as a property name
param
classLoader classLoader to use
return
the factory implementation
throws
FactoryConfigurationError if an instance of this factory cannot be loaded

      try {
          //do not fallback if given classloader can't find the class, throw exception
          return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
      } catch (FactoryFinder.ConfigurationError e) {
          throw new FactoryConfigurationError(e.getException(),
                  e.getMessage());
      }
  
public abstract voidsetLocation(javax.xml.stream.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.

param
location the location to set on each event created