blob: 8a27c3d6b37693e948c037c81d5575acf8313566 [file] [log] [blame]
import javax.xml.namespace.QName;
import org.apache.xmlbeans.*;
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\" ?>"+
"<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 XmlObject substitute(javax.xml.namespace.QName qName,org.apache.xmlbeans.SchemaType schemaType){
return underlyingXmlObject().substitute(qName, schemaType);
}
public void dump(){
System.out.println( _under.xmlText());
}
/**
*
*/
public static void main (String args[]) throws Exception
{
SimpleXmlObject test = new SimpleXmlObject();
System.out.println(test.xmlText());
}
}