5543eb9de8
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1824563 13f79535-47bb-0310-9956-ffa450edef68
68 lines
1.7 KiB
Plaintext
Executable File
68 lines
1.7 KiB
Plaintext
Executable File
|
|
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());
|
|
}
|
|
} |