org.sapia.util.xml.confix
Class JDOMProcessor

java.lang.Object
  |
  +--org.sapia.util.xml.confix.AbstractXMLProcessor
        |
        +--org.sapia.util.xml.confix.JDOMProcessor
All Implemented Interfaces:
ConfixProcessorIF

public class JDOMProcessor
extends AbstractXMLProcessor

This class creates an object graph for a given XML input stream. It internally uses JDOM to transform the stream into a JDOM document, and then to create objects from the elements found in the document.

Usage:

 ObjectFactoryIF fac = new ReflectionFactory("com.newtrade.company");
 JDOMProcessor proc = new JDOMProcessor(fac);
 Company comp = (Company)proc.process(new FileInputStream("d:/dev/company.xml"));
 

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Constructor Summary
JDOMProcessor(ObjectFactoryIF anObjectFactory)
          Creates a new JDOMProcessor instance with the argument passed in.
 
Method Summary
 Object process(InputStream is)
          This method takes an XML stream as input and returns an object representation of the passed-in XML.
 Object process(Object aParent, org.jdom.Element anElement)
          This method will process the dom element passed in to create an object.
 void process(Object root, InputStream is)
          This method takes an object and assigns to it the object representation of the passed XML stream.
 
Methods inherited from class org.sapia.util.xml.confix.AbstractXMLProcessor
assignToParent, containsMethod, convertChars, formatElementName, getObjectFactory, invokeMethod, invokeSetter, toMethodName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDOMProcessor

public JDOMProcessor(ObjectFactoryIF anObjectFactory)
Creates a new JDOMProcessor instance with the argument passed in.

Parameters:
anObjectFactory - The object factory of this processor.
Method Detail

process

public Object process(InputStream is)
               throws ProcessingException
This method takes an XML stream as input and returns an object representation of the passed-in XML.

Parameters:
is - an XML stream
Returns:
an object representation of the XML stream.
Throws:
ProcessingException

process

public void process(Object root,
                    InputStream is)
             throws ProcessingException
This method takes an object and assigns to it the object representation of the passed XML stream.

Parameters:
root - an Object that is the root of the object graph to create from the given XML.
is - an XML InputStream.
Throws:
ProcessingException - if an error occurs while processing the given XML stream.

process

public Object process(Object aParent,
                      org.jdom.Element anElement)
               throws ProcessingException
This method will process the dom element passed in to create an object.

Parameters:
aParent - The parent object of the one to create.
anElement - The dom element to process.
Throws:
ProcessingException - If an error occurs while processing the dom tree.


Copyright © 2002 Sapia Open Source Software. All Rights Reserved.