public class XMLFilterImpl extends Object implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
このモジュールは、ソース・コード、文書ともに公開ドメインに置かれています。したがって、内容に関する保証は一切提供されません。詳細については、http://www.saxproject.orgを参照してください。
このクラスは、XMLReader
とクライアント・アプリケーションのイベント・ハンドラの中間に置かれます。デフォルトでは、ハンドラに対するイベントを変更せずに要求をリーダーに渡すのみです。しかし、サブクラスでは特定のメソッドをオーバーライドして、転送中にイベント・ストリームや構成要求を変更できます。
XMLFilter
, XMLReader
, EntityResolver
, DTDHandler
, ContentHandler
, ErrorHandler
コンストラクタと説明 |
---|
XMLFilterImpl()
親を持たない空のXMLフィルタを構築します。
|
XMLFilterImpl(XMLReader parent)
指定された親を持つXMLフィルタを構築します。
|
修飾子と型 | メソッドと説明 |
---|---|
void |
characters(char[] ch, int start, int length)
文字データ・イベントをフィルタ・リングします。
|
void |
endDocument()
文書終了イベントをフィルタ・リングします。
|
void |
endElement(String uri, String localName, String qName)
要素終了イベントをフィルタ・リングします。
|
void |
endPrefixMapping(String prefix)
名前空間前置修飾子マッピングの終了イベントをフィルタ・リングします。
|
void |
error(SAXParseException e)
エラー・イベントをフィルタ・リングします。
|
void |
fatalError(SAXParseException e)
致命的なエラー・イベントをフィルタ・リングします。
|
ContentHandler |
getContentHandler()
コンテンツ・イベント・ハンドラを取得します。
|
DTDHandler |
getDTDHandler()
現在のDTDイベント・ハンドラを取得します。
|
EntityResolver |
getEntityResolver()
現在のエンティティ・リゾルバを取得します。
|
ErrorHandler |
getErrorHandler()
現在のエラー・イベント・ハンドラを取得します。
|
boolean |
getFeature(String name)
機能の値を検索します。
|
XMLReader |
getParent()
親リーダーを取得します。
|
Object |
getProperty(String name)
プロパティ値を検索します。
|
void |
ignorableWhitespace(char[] ch, int start, int length)
無視できる空白類文字イベントをフィルタ・リングします。
|
void |
notationDecl(String name, String publicId, String systemId)
表記法宣言イベントをフィルタ・リングします。
|
void |
parse(InputSource input)
文書を構文解析します。
|
void |
parse(String systemId)
文書を構文解析します。
|
void |
processingInstruction(String target, String data)
処理命令イベントをフィルタ・リングします。
|
InputSource |
resolveEntity(String publicId, String systemId)
外部エンティティ解決をフィルタ・リングします。
|
void |
setContentHandler(ContentHandler handler)
コンテンツ・イベント・ハンドラを設定します。
|
void |
setDocumentLocator(Locator locator)
新しい文書ロケータ・イベントをフィルタ・リングします。
|
void |
setDTDHandler(DTDHandler handler)
DTDイベント・ハンドラを設定します。
|
void |
setEntityResolver(EntityResolver resolver)
エンティティ・リゾルバを設定します。
|
void |
setErrorHandler(ErrorHandler handler)
エラー・イベント・ハンドラを設定します。
|
void |
setFeature(String name, boolean value)
機能の値を設定します。
|
void |
setParent(XMLReader parent)
親リーダーを設定します。
|
void |
setProperty(String name, Object value)
プロパティ値を設定します。
|
void |
skippedEntity(String name)
スキップされたエンティティ・イベントをフィルタ・リングします。
|
void |
startDocument()
文書開始イベントをフィルタ・リングします。
|
void |
startElement(String uri, String localName, String qName, Attributes atts)
要素開始イベントをフィルタ・リングします。
|
void |
startPrefixMapping(String prefix, String uri)
名前空間前置修飾子マッピングの開始イベントをフィルタ・リングします。
|
void |
unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
解析対象外エンティティ宣言イベントをフィルタ・リングします。
|
void |
warning(SAXParseException e)
警告イベントをフィルタ・リングします。
|
public XMLFilterImpl()
このフィルタは親を持ちません。このフィルタをXMLReader
としてではなく純粋なイベント・コンシューマとして使用しないかぎり、構文解析を始める前、あるいはsetFeatureまたはsetPropertyを使用して構成を始める前に親を割り当てる必要があります。
public XMLFilterImpl(XMLReader parent)
public void setParent(XMLReader parent)
親リーダーは、このフィルタがイベントを取得し、構成要求を渡すXMLReader
そのものです。親リーダーとして別のフィルタを指定することもできます。
親リーダーが設定されていないと、構文解析、機能またはプロパティの設定や取得に失敗します。
setParent
、インタフェース: XMLFilter
parent
- 親XMLリーダー。getParent()
public XMLReader getParent()
getParent
、インタフェース: XMLFilter
setParent(org.xml.sax.XMLReader)
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
親がnullの場合は常に失敗します。
setFeature
、インタフェース: XMLReader
name
- 機能名。value
- 要求された機能の値。SAXNotRecognizedException
- 機能値を割り当てられない、あるいは親から取得できない場合。SAXNotSupportedException
- 親が機能名を認識するだけで、要求された値を設定できない場合。XMLReader.getFeature(java.lang.String)
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
親がnullの場合は常に失敗します。
getFeature
、インタフェース: XMLReader
name
- 機能名。SAXNotRecognizedException
- 機能値を割り当てられない、あるいは親から取得できない場合。SAXNotSupportedException
- 親が機能名を認識するだけで、現時点ではその値を判断できない場合。XMLReader.setFeature(java.lang.String, boolean)
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
親がnullの場合は常に失敗します。
setProperty
、インタフェース: XMLReader
name
- プロパティ名。value
- 要求されたプロパティ値。SAXNotRecognizedException
- プロパティ値を割り当てられない、あるいは親から取得できない場合。SAXNotSupportedException
- 親がプロパティ名を認識するだけで、要求された値を設定できない場合。public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
、インタフェース: XMLReader
name
- プロパティ名。SAXNotRecognizedException
- プロパティ値を割り当てられない、あるいは親から取得できない場合。SAXNotSupportedException
- 親がプロパティ名を認識するだけで、現時点ではその値を判断できない場合。XMLReader.setProperty(java.lang.String, java.lang.Object)
public void setEntityResolver(EntityResolver resolver)
setEntityResolver
、インタフェース: XMLReader
resolver
- 新しいエンティティ・リゾルバ。XMLReader.getEntityResolver()
public EntityResolver getEntityResolver()
getEntityResolver
、インタフェース: XMLReader
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
public void setDTDHandler(DTDHandler handler)
setDTDHandler
、インタフェース: XMLReader
handler
- 新しいDTDハンドラXMLReader.getDTDHandler()
public DTDHandler getDTDHandler()
getDTDHandler
、インタフェース: XMLReader
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
public void setContentHandler(ContentHandler handler)
setContentHandler
、インタフェース: XMLReader
handler
- 新しいコンテンツ・ハンドラXMLReader.getContentHandler()
public ContentHandler getContentHandler()
getContentHandler
、インタフェース: XMLReader
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
、インタフェース: XMLReader
handler
- 新しいエラー・ハンドラXMLReader.getErrorHandler()
public ErrorHandler getErrorHandler()
getErrorHandler
、インタフェース: XMLReader
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(InputSource input) throws SAXException, IOException
parse
、インタフェース: XMLReader
input
- 文書エンティティの入力ソース。SAXException
- 任意のSAX例外。ほかの例外をラップしている可能性があります。IOException
- パーサーからのIO例外。アプリケーションが提供するバイト・ストリームまたは文字ストリームから発生する可能性があります。InputSource
, XMLReader.parse(java.lang.String)
, XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
, XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
, XMLReader.setContentHandler(org.xml.sax.ContentHandler)
, XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(String systemId) throws SAXException, IOException
parse
、インタフェース: XMLReader
systemId
- システム識別子を示す完全指定URI。SAXException
- 任意のSAX例外。ほかの例外をラップしている可能性があります。IOException
- パーサーからのIO例外。アプリケーションが提供するバイト・ストリームまたは文字ストリームから発生する可能性があります。XMLReader.parse(org.xml.sax.InputSource)
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
resolveEntity
、インタフェース: EntityResolver
publicId
- エンティティの公開識別子またはnull。systemId
- エンティティのシステム識別子。SAXException
- 処理中にクライアントが例外をスローする場合があります。IOException
- 新しいInputSourceの取得中にクライアントが入出力関連の例外をスローすることがあります。InputSource
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl
、インタフェース: DTDHandler
name
- 表記法名。publicId
- 表記法の公開識別子またはnull。systemId
- 表記法のシステム識別子またはnull。SAXException
- 処理中にクライアントが例外をスローする場合があります。DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
, Attributes
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl
、インタフェース: DTDHandler
name
- エンティティ名。publicId
- エンティティの公開識別子またはnull。systemId
- エンティティのシステム識別子またはnull。notationName
- 関連表記法名。SAXException
- 処理中にクライアントが例外をスローする場合があります。DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)
, Attributes
public void setDocumentLocator(Locator locator)
setDocumentLocator
、インタフェース: ContentHandler
locator
- 文書ロケータ。Locator
public void startDocument() throws SAXException
startDocument
、インタフェース: ContentHandler
SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.endDocument()
public void endDocument() throws SAXException
endDocument
、インタフェース: ContentHandler
SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.startDocument()
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
、インタフェース: ContentHandler
prefix
- 名前空間接頭辞。uri
- 名前空間URI。SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.endPrefixMapping(java.lang.String)
, ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
、インタフェース: ContentHandler
prefix
- 名前空間接頭辞。SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
, ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
startElement
、インタフェース: ContentHandler
uri
- 要素の名前空間URI、または空文字列。localName
- 要素のローカル名、または空文字列。qName
- 要素の接頭辞付きの修飾名、または空文字列。atts
- 要素の属性。SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)
, Attributes
, AttributesImpl
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
、インタフェース: ContentHandler
uri
- 要素の名前空間URI、または空文字列。localName
- 要素のローカル名、または空文字列。qName
- 要素の接頭辞付きの修飾名、または空文字列。SAXException
- 処理中にクライアントが例外をスローする場合があります。public void characters(char[] ch, int start, int length) throws SAXException
characters
、インタフェース: ContentHandler
ch
- 文字配列。start
- 配列内の開始位置。length
- 配列から使用される文字数。SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.ignorableWhitespace(char[], int, int)
, Locator
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
、インタフェース: ContentHandler
ch
- 文字配列。start
- 配列内の開始位置。length
- 配列から使用される文字数。SAXException
- 処理中にクライアントが例外をスローする場合があります。ContentHandler.characters(char[], int, int)
public void processingInstruction(String target, String data) throws SAXException
processingInstruction
、インタフェース: ContentHandler
target
- 処理命令のターゲット。data
- ターゲットのあとに続くテキスト。SAXException
- 処理中にクライアントが例外をスローする場合があります。public void skippedEntity(String name) throws SAXException
skippedEntity
、インタフェース: ContentHandler
name
- スキップされたエンティティの名前。SAXException
- 処理中にクライアントが例外をスローする場合があります。public void warning(SAXParseException e) throws SAXException
warning
、インタフェース: ErrorHandler
e
- 警告を示す例外。SAXException
- 処理中にクライアントが例外をスローする場合があります。SAXParseException
public void error(SAXParseException e) throws SAXException
error
、インタフェース: ErrorHandler
e
- エラーを示す例外。SAXException
- 処理中にクライアントが例外をスローする場合があります。SAXParseException
public void fatalError(SAXParseException e) throws SAXException
fatalError
、インタフェース: ErrorHandler
e
- エラーを示す例外。SAXException
- 処理中にクライアントが例外をスローする場合があります。SAXParseException
バグまたは機能を送信
詳細なAPIリファレンスおよび開発者ドキュメントについては、Java SEのドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。