You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

FILTER

キーワードFILTERまたはFILTERCLASSを使って、XML DOM ドキュメントに適用するコンテント・フィルターを指定します。キーワードFILTERの値を使って、XMLBindFileServiceプロパティ・ファイルのfilter.'value'プロパティにより指定されたフィルタークラス名を検索できます。このフィルタークラス名は、キーワードFILTERCLASSを使って直接指定することも可能です。

package com.acme.filter ;
 
import java.io.* ;
 
import java.util.HashMap ;
 
import org.w3c.dom.Document ;
 
import com.acme.jsm.JSMTrace ;
import com.acme.jsm.JSMCommand ;
import com.acme.jsm.JSMResource ;
 
public class SampleFilter implements com.acme.jsm.service.ContentFilter
{
    public Object filter ( HashMap properties, Object content )
    {
        if ( content == null )
        {
            return null ;
        }
 
        if ( !(content instanceof Document) )
        {
            throw new IllegalArgumentException ( "SampleFilter: unexpected content class: " + content.getClass().getName() ) ;
        }
 
        JSMTrace trace = (JSMTrace)properties.get ( "jsm.trace" ) ;
 
        JSMCommand command = (JSMCommand)properties.get ( "jsm.command" ) ;
 
        JSMResource resource = (JSMResource)properties.get ( "jsm.resource" ) ;
 
        if ( trace != null )
        {
            m_trace.println ( "Apply SampleFilter" ) ;
        }
 
        /*
            新規オフジェクトの修正または作成
        */
 
        /*
            置換、または既存のオブジェクトに戻る
        */
 
        return content ;
    }
}
 

  • No labels