XMLEventFactory (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.xml.stream Class XMLEventFactory

java.lang.Object
  extended by javax.xml.stream.XMLEventFactory

public abstract class XMLEventFactory
extends Object

This interface defines a utility class for creating instances of XMLEvents

版本:
1.0
作者:
Copyright (c) 2003 by BEA Systems. All Rights Reserved.
另请参见:
StartElement, EndElement, ProcessingInstruction, Comment, Characters, StartDocument, EndDocument, DTD

构造器摘要
protected XMLEventFactory()
           
 
方法摘要
abstract  Attribute createAttribute(QName name, String value)
          Create a new Attribute
abstract  Attribute createAttribute(String localName, String value)
          Create a new Attribute
abstract  Attribute createAttribute(String prefix, String namespaceURI, String localName, String value)
          Create a new Attribute
abstract  Characters createCData(String content)
          Create a Characters event with the CData flag set to true
abstract  Characters createCharacters(String content)
          Create a Characters event, this method does not check if the content is all whitespace.
abstract  Comment createComment(String text)
          Create a comment
abstract  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
abstract  EndDocument createEndDocument()
          Creates a new instance of an EndDocument event
abstract  EndElement createEndElement(QName name, Iterator namespaces)
          Create a new EndElement
abstract  EndElement createEndElement(String prefix, String namespaceUri, String localName)
          Create a new EndElement
abstract  EndElement createEndElement(String prefix, String namespaceUri, String localName, Iterator namespaces)
          Create a new EndElement
abstract  EntityReference createEntityReference(String name, EntityDeclaration declaration)
          Creates a new instance of a EntityReference event
abstract  Characters createIgnorableSpace(String content)
          Create an ignorable space
abstract  Namespace createNamespace(String namespaceURI)
          Create a new default Namespace
abstract  Namespace createNamespace(String prefix, String namespaceUri)
          Create a new Namespace
abstract  ProcessingInstruction createProcessingInstruction(String target, String data)
          Create a processing instruction
abstract  Characters createSpace(String content)
          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(String encoding)
          Creates a new instance of a StartDocument event
abstract  StartDocument createStartDocument(String encoding, String version)
          Creates a new instance of a StartDocument event
abstract  StartDocument createStartDocument(String encoding, String version, boolean standalone)
          Creates a new instance of a StartDocument event
abstract  StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces)
          Create a new StartElement.
abstract  StartElement createStartElement(String prefix, String namespaceUri, String localName)
          Create a new StartElement.
abstract  StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces)
          Create a new StartElement.
abstract  StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context)
          Create a new StartElement.
static XMLEventFactory newInstance()
          Create a new instance of the factory
static XMLEventFactory newInstance(String factoryId, ClassLoader classLoader)
          Create a new instance of the factory
abstract  void setLocation(Location location)
          This method allows setting of the Location on each event that is created by this factory.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造器详细信息

XMLEventFactory

protected XMLEventFactory()
方法详细信息

newInstance

public static XMLEventFactory newInstance()
                                   throws FactoryConfigurationError
Create a new instance of the factory

抛出异常:
FactoryConfigurationError - if an instance of this factory cannot be loaded

newInstance

public static XMLEventFactory newInstance(String factoryId,
                                          ClassLoader classLoader)
                                   throws FactoryConfigurationError
Create a new instance of the factory

参数:
factoryId - Name of the factory to find, same as a property name
classLoader - classLoader to use
返回:
the factory implementation
抛出异常:
FactoryConfigurationError - if an instance of this factory cannot be loaded

setLocation

public abstract 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.

参数:
location - the location to set on each event created

createAttribute

public abstract Attribute createAttribute(String prefix,
                                          String namespaceURI,
                                          String localName,
                                          String value)
Create a new Attribute

参数:
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
返回:
the Attribute with specified values

createAttribute

public abstract Attribute createAttribute(String localName,
                                          String value)
Create a new Attribute

参数:
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
返回:
the Attribute with specified values

createAttribute

public abstract Attribute createAttribute(QName name,
                                          String value)
Create a new Attribute

参数:
name - the qualified name of the attribute, may not be null
value - the attribute value to set, may not be null
返回:
the Attribute with specified values

createNamespace

public abstract Namespace createNamespace(String namespaceURI)
Create a new default Namespace

参数:
namespaceURI - the default namespace uri
返回:
the Namespace with the specified value

createNamespace

public abstract Namespace createNamespace(String prefix,
                                          String namespaceUri)
Create a new Namespace

参数:
prefix - the prefix of this namespace, may not be null
namespaceUri - the attribute value is set to this value, may not be null
返回:
the Namespace with the specified values

createStartElement

public abstract StartElement createStartElement(QName name,
                                                Iterator attributes,
                                                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.

参数:
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
返回:
an instance of the requested StartElement

createStartElement

public abstract StartElement createStartElement(String prefix,
                                                String namespaceUri,
                                                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.

参数:
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
返回:
an instance of the requested StartElement

createStartElement

public abstract StartElement createStartElement(String prefix,
                                                String namespaceUri,
                                                String localName,
                                                Iterator attributes,
                                                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.

参数:
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
返回:
an instance of the requested StartElement

createStartElement

public abstract StartElement createStartElement(String prefix,
                                                String namespaceUri,
                                                String localName,
                                                Iterator attributes,
                                                Iterator namespaces,
                                                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.

参数:
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
返回:
an instance of the requested StartElement

createEndElement

public abstract EndElement createEndElement(QName name,
                                            Iterator namespaces)
Create a new EndElement

参数:
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
返回:
an instance of the requested EndElement

createEndElement

public abstract EndElement createEndElement(String prefix,
                                            String namespaceUri,
                                            String localName)
Create a new EndElement

参数:
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
返回:
an instance of the requested EndElement

createEndElement

public abstract EndElement createEndElement(String prefix,
                                            String namespaceUri,
                                            String localName,
                                            Iterator namespaces)
Create a new EndElement

参数:
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
返回:
an instance of the requested EndElement

createCharacters

public abstract 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)

参数:
content - the string to create
返回:
a Characters event

createCData

public abstract Characters createCData(String content)
Create a Characters event with the CData flag set to true

参数:
content - the string to create
返回:
a Characters event

createSpace

public abstract Characters createSpace(String content)
Create a Characters event with the isSpace flag set to true

参数:
content - the content of the space to create
返回:
a Characters event

createIgnorableSpace

public abstract Characters createIgnorableSpace(String content)
Create an ignorable space

参数:
content - the space to create
返回:
a Characters event

createStartDocument

public abstract StartDocument createStartDocument()
Creates a new instance of a StartDocument event

返回:
a StartDocument event

createStartDocument

public abstract StartDocument createStartDocument(String encoding,
                                                  String version,
                                                  boolean standalone)
Creates a new instance of a StartDocument event

参数:
encoding - the encoding style
version - the XML version
standalone - the status of standalone may be set to "true" or "false"
返回:
a StartDocument event

createStartDocument

public abstract StartDocument createStartDocument(String encoding,
                                                  String version)
Creates a new instance of a StartDocument event

参数:
encoding - the encoding style
version - the XML version
返回:
a StartDocument event

createStartDocument

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

参数:
encoding - the encoding style
返回:
a StartDocument event

createEndDocument

public abstract EndDocument createEndDocument()
Creates a new instance of an EndDocument event

返回:
an EndDocument event

createEntityReference

public abstract EntityReference createEntityReference(String name,
                                                      EntityDeclaration declaration)
Creates a new instance of a EntityReference event

参数:
name - The name of the reference
declaration - the declaration for the event
返回:
an EntityReference event

createComment

public abstract Comment createComment(String text)
Create a comment

参数:
text - The text of the comment a Comment event

createProcessingInstruction

public abstract ProcessingInstruction createProcessingInstruction(String target,
                                                                  String data)
Create a processing instruction

参数:
target - The target of the processing instruction
data - The text of the processing instruction
返回:
a ProcessingInstruction event

createDTD

public abstract 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

参数:
dtd - the text of the document type definition
返回:
a DTD event

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.