The Sample Xbean

Function

The sample Xbean does nothing useful! It simiply passes the DOM document that it receives to the next Xbean in the channel. Placing the sample Xbean in a channel has no effect. 

The source code for the sample Xbean serves as a starting point for developers of new Xbeans.

Bean Properties

DOMListener As with all source Xbeans, the DOMListener property is the next Xbean in the channel. The DOMListener receives the DOM produced by this Xbean.

Usage

The sample Xbean is in the org.xbeans.sample package. The package can be imported into Java source code as follows:

import org.xbeans.sample.SampleBean;

Creating a sample Xbean is accomplished by instantiating the class:

SampleBean sample = new SampleBean();

Note that if you are using a Java Bean design tools found in many Java Integrated Development Environments, the above code is generated automatically when you drag and drop a parser Xbean into your application.

You need to get a DOM document by registering the sample with the previous Xbean in the channel.

previousXbean.setDOMListener(sample);

You need to establish which Xbean will receive the DOM document from the sample. To pass the document on to the next Xbean, you simply register the next Xbean to be the DOM Listener.

sample.setDOMListener(nextXbean);

Again, if you are using a Java Bean design tool, the above calls to set properties may be automatically generated for you.

The above three calls inserts a sample Xbean into a channel. It has no effect on the behavior of the channel since the sample Xbean simply recieves the DOM document and passes it on to the next Xbean.

Source files

source/org/xbeans/sample/SampleBean.java
source/org/xbeans/sample/SampleBeanBeanInfo.java