クラスXMLEventFactory
java.lang.Object
javax.xml.stream.XMLEventFactory
public abstract class XMLEventFactory extends Object
このインタフェースは、XMLEventのインスタンスを作成するためのユーティリティ・クラスを定義します。
- 導入されたバージョン:
- 1.6
- 関連項目:
-
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明abstract AttributecreateAttribute(String localName, String value) 新しいAttributeを作成します。abstract AttributecreateAttribute(String prefix, String namespaceURI, String localName, String value) 新しいAttributeを作成します。abstract AttributecreateAttribute(QName name, String value) 新しいAttributeを作成します。abstract CharacterscreateCData(String content) CDataフラグがtrueに設定されているCharactersイベントを作成します。abstract CharacterscreateCharacters(String content) Charactersイベントを作成します。このメソッドは、内容がすべて空白文字であるかどうかをチェックしません。abstract CommentcreateComment(String text) コメントを作成します。abstract DTD文書型定義イベントを作成します。この文字列には、XML 1.0仕様のdoctypedeclに一致する文書型宣言のすべてが含まれます。abstract EndDocumentEndDocumentイベントの新しいインスタンスを作成します。abstract EndElementcreateEndElement(String prefix, String namespaceUri, String localName) 新しいEndElementを作成します。abstract EndElementcreateEndElement(String prefix, String namespaceUri, String localName, Iterator<? extends Namespace> namespaces) 新しいEndElementを作成します。abstract EndElementcreateEndElement(QName name, Iterator<? extends Namespace> namespaces) 新しいEndElementを作成します。abstract EntityReferencecreateEntityReference(String name, EntityDeclaration declaration) EntityReferenceイベントの新しいインスタンスを作成します。abstract CharacterscreateIgnorableSpace(String content) 無視できる空白を作成します。abstract NamespacecreateNamespace(String namespaceURI) 新しいデフォルトのNamespaceを作成します。abstract NamespacecreateNamespace(String prefix, String namespaceUri) 新しいNamespaceを作成します。abstract ProcessingInstructioncreateProcessingInstruction(String target, String data) 処理命令を作成します。abstract CharacterscreateSpace(String content) isSpaceフラグがtrueに設定されているCharactersイベントを作成します。abstract StartDocumentStartDocumentイベントの新しいインスタンスを作成します。abstract StartDocumentcreateStartDocument(String encoding) StartDocumentイベントの新しいインスタンスを作成します。abstract StartDocumentcreateStartDocument(String encoding, String version) StartDocumentイベントの新しいインスタンスを作成します。abstract StartDocumentcreateStartDocument(String encoding, String version, boolean standalone) StartDocumentイベントの新しいインスタンスを作成します。abstract StartElementcreateStartElement(String prefix, String namespaceUri, String localName) 新しいStartElementを作成します。abstract StartElementcreateStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces) 新しいStartElementを作成します。abstract StartElementcreateStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces, NamespaceContext context) 新しいStartElementを作成します。abstract StartElementcreateStartElement(QName name, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces) 新しいStartElementを作成します。static XMLEventFactoryXMLEventFactory組込みシステム・デフォルト実装の新しいインスタンスを作成します。static XMLEventFactoryファクトリの新しいインスタンスを作成します。static XMLEventFactorynewFactory(String factoryId, ClassLoader classLoader) ファクトリの新しいインスタンスを作成します。static XMLEventFactorynewFactory()メソッドとまったく同様にファクトリの新しいインスタンスを作成します。static XMLEventFactorynewInstance(String factoryId, ClassLoader classLoader) 非推奨。APIの整合性を維持するために、このメソッドは非推奨になりました。abstract voidsetLocation(Location location) このメソッドを使用すると、このファクトリによって作成された各イベントでLocationを設定できます。
-
コンストラクタの詳細
-
XMLEventFactory
protected XMLEventFactory()インスタンス化を妨げるprotectedコンストラクタです。 代わりにnewFactory()を使用してください。
-
-
メソッドの詳細
-
newDefaultFactory
public static XMLEventFactory newDefaultFactory()XMLEventFactory組込みシステム・デフォルト実装の新しいインスタンスを作成します。- 戻り値:
XMLEventFactory組込みシステム・デフォルト実装の新しいインスタンス。- 導入されたバージョン:
- 9
-
newInstance
public static XMLEventFactory newInstance() throws FactoryConfigurationErrornewFactory()メソッドとまったく同様にファクトリの新しいインスタンスを作成します。- 戻り値:
XMLEventFactoryのインスタンス- 例外:
FactoryConfigurationError- このファクトリのインスタンスをロードできない場合
-
newFactory
public static XMLEventFactory newFactory() throws FactoryConfigurationErrorファクトリの新しいインスタンスを作成します。 このメソッドは、「JAXPルックアップ・メカニズム」を使用して、ロードするXMLEventFactory実装クラスを決定します。アプリケーションが
XMLEventFactoryへの参照を取得すると、ファクトリを使用してストリーム・インスタンスを構成および取得できます。- 戻り値:
XMLEventFactoryのインスタンス- 例外:
FactoryConfigurationError- サービス構成エラーが発生した場合、または実装が使用できないかインスタンス化できない場合。
-
newInstance
@Deprecated(since="1.7") public static XMLEventFactory newInstance(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError 非推奨。APIの整合性を維持するために、このメソッドは非推奨になりました。 すべてのnewInstanceメソッドが、対応するnewFactoryメソッドに置き換えられています。 代替のnewFactory(java.lang.String, java.lang.ClassLoader)メソッドでは、動作の変更は定義されていません。ファクトリの新しいインスタンスを作成します。- パラメータ:
factoryId- 検索するファクトリの名前。プロパティ名と同一classLoader- 使用するclassLoader- 戻り値:
- ファクトリの実装
- 例外:
FactoryConfigurationError- このファクトリのインスタンスをロードできない場合
-
newFactory
public static XMLEventFactory newFactory(String factoryId, ClassLoader classLoader) throws FactoryConfigurationError ファクトリの新しいインスタンスを作成します。 classLoader引数がnullの場合、ContextClassLoaderが使用されます。このメソッドは次の順序の検索手順で、ロードするXMLEventFactory実装クラスを決定します。
-
factoryIdによって識別されるシステム・プロパティの値を使用する。 -
デフォルトでは、「構成ファイル」、jaxp.propertiesに設定されたプロパティ
factoryIdの値を使用します。 ファイルが存在し、ファイル内にプロパティfactoryIdが指定されている場合は、その値が実装クラスとして使用されます。 -
factoryIdが"javax.xml.stream.XMLEventFactory"の場合は、ServiceLoaderクラスで定義されたサービス・プロバイダのロード機能を使用して、指定されたClassLoaderを使用してサービスの実装を「見つけて読み込む」しようとします。classLoaderがnullである場合、デフォルトのロード・メカニズムが適用される。つまり、サービス・プロバイダのロード機能は、現在のスレッドのコンテキスト・クラス・ローダーを使用してサービスのロードを試みる。 コンテキスト・クラス・ローダーがnullの場合、システム・クラス・ローダーが使用されます。 -
それ以外の場合は、
FactoryConfigurationErrorをスローする。
これは非推奨の
newInstance(String factoryId、ClassLoader classLoader)メソッドを置き換える新しいメソッドです。 非推奨のメソッドに関連して、この置換メソッドによって定義されている動作に変更はありません。- APIのノート:
- ここで定義されているパラメータfactoryIdは、最初のパラメータがファクトリの実装を提供する完全修飾ファクトリ・クラス名である、他のJAXPファクトリのfactoryIdとは一致しません。
- パラメータ:
factoryId- 検索するファクトリの名前。プロパティ名と同一classLoader- 使用するclassLoader- 戻り値:
- ファクトリの実装
- 例外:
FactoryConfigurationError- サービス構成エラーが発生した場合、または実装が使用できないかインスタンス化できない場合。
-
-
setLocation
public abstract void setLocation(Location location) このメソッドを使用すると、このファクトリによって作成された各イベントでLocationを設定できます。 これらの値は、このファクトリによって作成されたイベントに値コピーされます。 位置情報をリセットするには、位置をnullに設定します。- パラメータ:
location- 作成されるイベントごとに設定する位置
-
createAttribute
-
createAttribute
-
createAttribute
-
createNamespace
-
createNamespace
-
createStartElement
public abstract StartElement createStartElement(QName name, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces) 新しいStartElementを作成します。 Namespaceインタフェースのセットを順次処理するイテレータを渡すことで、NamespaceをこのStartElementに追加できます。 Attributeインタフェースのセットを順次処理するイテレータを渡すことで、AttributeをこのStartElementに追加できます。- パラメータ:
name- 属性の修飾名。null以外attributes- 新しいStartElementに追加するAttributeを実装するオブジェクトの順序付けされていないオプション・セット。nullの場合もあるnamespaces- 新しいStartElementに追加するNamespaceを実装するオブジェクトの順序付けされていないオプション・セット。nullの場合もある- 戻り値:
- 要求されたStartElementのインスタンス
-
createStartElement
public abstract StartElement createStartElement(String prefix, String namespaceUri, String localName) 新しいStartElementを作成します。 NamespaceContextのデフォルトを空のNamespaceContextに設定します。 このイベントを名前空間または属性で照会すると、空のイテレータが返されます。- パラメータ:
prefix- 新しいStartElementのQNameの接頭辞namespaceUri- 新しいStartElementのQNameのURIlocalName- 新しいStartElementのQNameのローカル名- 戻り値:
- 要求されたStartElementのインスタンス
-
createStartElement
public abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces) 新しいStartElementを作成します。 Namespaceインタフェースのセットを順次処理するイテレータを渡すことで、NamespaceをこのStartElementに追加できます。 Attributeインタフェースのセットを順次処理するイテレータを渡すことで、AttributeをこのStartElementに追加できます。- パラメータ:
prefix- 新しいStartElementのQNameの接頭辞namespaceUri- 新しいStartElementのQNameのURIlocalName- 新しいStartElementのQNameのローカル名attributes- 新しいStartElementに追加するAttributeを実装するオブジェクトの順序付けされていないセットnamespaces- 新しいStartElementに追加するNamespaceを実装するオブジェクトの順序付けされていないセット- 戻り値:
- 要求されたStartElementのインスタンス
-
createStartElement
public abstract StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator<? extends Attribute> attributes, Iterator<? extends Namespace> namespaces, NamespaceContext context) 新しいStartElementを作成します。 Namespaceインタフェースのセットを順次処理するイテレータを渡すことで、NamespaceをこのStartElementに追加できます。 Attributeインタフェースのセットを順次処理するイテレータを渡すことで、AttributeをこのStartElementに追加できます。- パラメータ:
prefix- 新しいStartElementのQNameの接頭辞namespaceUri- 新しいStartElementのQNameのURIlocalName- 新しいStartElementのQNameのローカル名attributes- 新しいStartElementに追加するAttributeを実装するオブジェクトの順序付けされていないセット。nullの場合もあるnamespaces- 新しいStartElementに追加するNamespaceを実装するオブジェクトの順序付けされていないセット。nullの場合もあるcontext- この要素の名前空間コンテキスト- 戻り値:
- 要求されたStartElementのインスタンス
-
createEndElement
public abstract EndElement createEndElement(QName name, Iterator<? extends Namespace> namespaces) 新しいEndElementを作成します。- パラメータ:
name- EndElementの修飾名namespaces- 範囲外になったNamespaceを実装するオブジェクトの順序付けされていないオプション・セット。nullの場合もある- 戻り値:
- 要求されたEndElementのインスタンス
-
createEndElement
public abstract EndElement createEndElement(String prefix, String namespaceUri, String localName) 新しいEndElementを作成します。- パラメータ:
prefix- 新しいStartElementのQNameの接頭辞namespaceUri- 新しいStartElementのQNameのURIlocalName- 新しいStartElementのQNameのローカル名- 戻り値:
- 要求されたEndElementのインスタンス
-
createEndElement
public abstract EndElement createEndElement(String prefix, String namespaceUri, String localName, Iterator<? extends Namespace> namespaces) 新しいEndElementを作成します。- パラメータ:
prefix- 新しいStartElementのQNameの接頭辞namespaceUri- 新しいStartElementのQNameのURIlocalName- 新しいStartElementのQNameのローカル名namespaces- 範囲外になったNamespaceを実装するオブジェクトの順序付けされていないセット。nullの場合もある- 戻り値:
- 要求されたEndElementのインスタンス
-
createCharacters
public abstract Characters createCharacters(String content) Charactersイベントを作成します。このメソッドは、内容がすべて空白文字であるかどうかをチェックしません。 空白イベントを作成するには、#createSpace(String)を使用します- パラメータ:
content- 作成する文字列- 戻り値:
- Charactersイベント
-
createCData
public abstract Characters createCData(String content) CDataフラグがtrueに設定されているCharactersイベントを作成します。- パラメータ:
content- 作成する文字列- 戻り値:
- Charactersイベント
-
createSpace
public abstract Characters createSpace(String content) isSpaceフラグがtrueに設定されているCharactersイベントを作成します。- パラメータ:
content- 作成する空白の内容- 戻り値:
- Charactersイベント
-
createIgnorableSpace
public abstract Characters createIgnorableSpace(String content) 無視できる空白を作成します。- パラメータ:
content- 作成する空白- 戻り値:
- Charactersイベント
-
createStartDocument
public abstract StartDocument createStartDocument()StartDocumentイベントの新しいインスタンスを作成します。- 戻り値:
- StartDocumentイベント
-
createStartDocument
public abstract StartDocument createStartDocument(String encoding, String version, boolean standalone) StartDocumentイベントの新しいインスタンスを作成します。- パラメータ:
encoding- エンコーディング形式version- XMLバージョンstandalone- スタンドアロンの状態はtrueまたはfalseに設定される- 戻り値:
- StartDocumentイベント
-
createStartDocument
public abstract StartDocument createStartDocument(String encoding, String version) StartDocumentイベントの新しいインスタンスを作成します。- パラメータ:
encoding- エンコーディング形式version- XMLバージョン- 戻り値:
- StartDocumentイベント
-
createStartDocument
public abstract StartDocument createStartDocument(String encoding) StartDocumentイベントの新しいインスタンスを作成します。- パラメータ:
encoding- エンコーディング形式- 戻り値:
- StartDocumentイベント
-
createEndDocument
public abstract EndDocument createEndDocument()EndDocumentイベントの新しいインスタンスを作成します。- 戻り値:
- EndDocumentイベント
-
createEntityReference
public abstract EntityReference createEntityReference(String name, EntityDeclaration declaration) EntityReferenceイベントの新しいインスタンスを作成します。- パラメータ:
name- 参照の名前declaration- イベントの宣言- 戻り値:
- EntityReferenceイベント
-
createComment
-
createProcessingInstruction
public abstract ProcessingInstruction createProcessingInstruction(String target, String data) 処理命令を作成します。- パラメータ:
target- 処理命令のターゲットdata- 処理命令のテキスト- 戻り値:
- ProcessingInstructionイベント
-
createDTD
-