import javax.xml.namespace.QName; | |
import com.bea.xml.*; | |
import dumbNS.RootDocument; | |
/** | |
* Test Class that extends the abstract base class FilterXmlObject | |
* The only method that needs to be implemented is underlyingXmlObject(); | |
* | |
* @author: Raju Subramanian. | |
*/ | |
public class SimpleXmlObject | |
extends FilterXmlObject | |
{ | |
/** | |
* The underlying XmlObject to which all calls will be delegated | |
*/ | |
private transient XmlObject _under; | |
/** | |
* Default constructor that creates a XmlObject from the instance | |
* xbean/simple/dumb/dumb.xml | |
*/ | |
public SimpleXmlObject() | |
throws Exception | |
{ | |
try { | |
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + | |
"<root xmlns=\"dumbNS\" xmlns:bar=\"barNS\" b=\"3\" bar:b=\"4\"/>"; | |
RootDocument rootDoc = (RootDocument)XmlObject.Factory.parse(xml); | |
// Set the underlying XmlObject | |
_under = (XmlObject) rootDoc; | |
} catch (Exception e) | |
{ | |
throw new Exception("Error creating XmlObject: " + e); | |
} | |
} | |
/** | |
* The underlyingXmlObject() implementation | |
*/ | |
public XmlObject underlyingXmlObject() | |
{ | |
return _under; | |
} | |
/** | |
* | |
*/ | |
public static void main (String args[]) throws Exception | |
{ | |
SimpleXmlObject test = new SimpleXmlObject(); | |
System.out.println(test.xmlText()); | |
} | |
} |