BEA Systems, Inc.

BEA WebLogic Server 9.0 API Reference


weblogic.xml.xpath
Interface XPathStreamObserver


public interface XPathStreamObserver

Defines objects which wish to be notified when events encountered in an XMLInputStream match a particular xpath. When the stream's client asks for the next() event, it is evaluated against an xpath; if it matches, the observer is notified of the event via the observeMatch() just before it is returned to the client.

Instances of this class are installed in an XPathStreamFactory where they are paired with a StreamXPath for which they wish to receive match notifications.

Since XPathSreamObservers will receive notifications on all of the streams created by the XPathStreamFactory in which they are installed, it is usually necessary for them to be stateless unless it can be guaranteed that the observer will never be accessed by multiple threads or for matching against different streams.

An example of such a case may occur if a client wishes to alter the stream based on xpath matches. Although this interface does not provide facilities for altering the stream, match-based mutations of the stream can easily be performed by creating a new class which does the following:

Copyright © 2005 BEA Systems, Inc. All Rights Reserved.

Method Summary
 void observe(XMLEvent event)
          Handles notification when an XMLEvent is encountered on the stream which represents a matching node that is not an attribute or namespace node.
 void observeAttribute(StartElement event, Attribute attribute)
          Handles notification when an XMLEvent is encountered on the stream which contains an attribute meets the criteria with which the observer was installed in the XPathStreamFactory.
 void observeNamespace(StartElement event, Attribute attribute)
           
 

Method Detail

observe

public void observe(XMLEvent event)
Handles notification when an XMLEvent is encountered on the stream which represents a matching node that is not an attribute or namespace node. The latter two cases are handled by observeAttribute() and observeNamespace() as described below.

Parameters:
event - The XMLEvent which matched the XPath.

observeAttribute

public void observeAttribute(StartElement event,
                             Attribute attribute)
Handles notification when an XMLEvent is encountered on the stream which contains an attribute meets the criteria with which the observer was installed in the XPathStreamFactory. Note that a given XMLEvent may have more than one matching attribute - a call to this method will result from each match.

Parameters:
event - The XMLEvent which contains the attribute which matched
attribute - The Attribute which matched

observeNamespace

public void observeNamespace(StartElement event,
                             Attribute attribute)
Parameters:
event - The XMLEvent which contains the attribute which matched
attribute - The Attribute which contains the matched namespace declaration which matched

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs90
Copyright 2005 BEA Systems Inc.