public class XMLDoc extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
XMLDoc.MyEntityResolver |
Constructor and Description |
---|
XMLDoc()
Creates the empty doc
|
XMLDoc(InputStream is)
Build a document object tree from an input
stream
|
XMLDoc(String data)
Construct a new document tree from a string form of
an xml document
|
XMLDoc(StringBuilder data)
Construct a new document tree from a StringBuilder form of
an xml document
|
XMLDoc(XMLDoc oldDoc,
Object parent)
Construct a document from all the children of an existing element object from another document.
|
Modifier and Type | Method and Description |
---|---|
void |
addDocumentElement(Object where,
XMLDoc oldDoc,
Object parent)
Add the children of another document's node as the children of this node.
|
Object |
createElement(Object who,
String ename)
Create an element
|
Object |
createText(Object who,
String data)
Create a free-form data value (vs attribute value=)
|
protected Node |
duplicateNode(Node node)
Make a (deep) copy of a node.
|
ArrayList |
getAttributes(Object n)
Extract the attribute names from the given
node.
|
String |
getData(Object obj)
Get TEXT element value as single string.
|
protected Object |
getDocument()
Return the document root; may be null
|
Object |
getElement(Object parent,
String tagname)
Return the first object to match tagname
|
String |
getNodeName(Object el)
Return element name.
|
Object |
getRoot()
Return root node
|
Object |
getRoot(Object obj)
Return root node
|
String |
getValue(Object elo,
String a)
Return the value of a named attribute
|
String |
getXML()
Serialize the document object to a safe string
|
String |
getXMLNoEntityPreamble()
Get XML with no entity preamble
|
void |
processPath(ArrayList returnList,
String path,
Object currentRoot) |
ArrayList |
processPath(String path,
Object o) |
protected int |
searchArrayForAttribute(ArrayList l,
int i,
String attribute,
String value)
Having collected an arraylist from a given
depth in the tree, scan the node for the current
attribute specified (part of wildcard matching
of xpath-like element specification)
|
void |
setAttribute(Object e,
String sName,
String sValue)
Set an attribute on an element
|
protected void |
setDocument(Object d) |
byte[] |
toByteArray()
Convert the response for transmit
|
public static final String _rcsid
public XMLDoc() throws ManifoldCFException
ManifoldCFException
public XMLDoc(String data) throws ManifoldCFException
data
- xml to parseManifoldCFException
public XMLDoc(StringBuilder data) throws ManifoldCFException
data
- xml to parseManifoldCFException
public XMLDoc(InputStream is) throws ManifoldCFException
is
- InputStream of xml to parseManifoldCFException
public XMLDoc(XMLDoc oldDoc, Object parent) throws ManifoldCFException
ManifoldCFException
protected Object getDocument()
protected void setDocument(Object d)
protected int searchArrayForAttribute(ArrayList l, int i, String attribute, String value)
l
- list of elements foundi
- starting indexattribute
- String to findvalue
- String attribute value to matchpublic String getXML() throws ManifoldCFException
ManifoldCFException
public String getXMLNoEntityPreamble() throws ManifoldCFException
ManifoldCFException
public byte[] toByteArray() throws ManifoldCFException
ManifoldCFException
public final String getValue(Object elo, String a)
elo
- Object to aska
- String attribute to findpublic final String getNodeName(Object el)
el
- Object to askpublic final String getData(Object obj)
obj
- Element to grab datapublic Object getRoot()
public Object getRoot(Object obj)
obj
- Object document, might not be 'this'public final ArrayList getAttributes(Object n)
n
- Object to askpublic Object getElement(Object parent, String tagname)
parent
- Objecttagname
- String nodenamepublic Object createElement(Object who, String ename)
who
- Object parent Nodeename
- String element namepublic void addDocumentElement(Object where, XMLDoc oldDoc, Object parent)
public void setAttribute(Object e, String sName, String sValue)
e
- Object element to modifysName
- String attribute namesValue
- String attribute valuepublic Object createText(Object who, String data)
who
- Objectdata
- String text to add as cdata/text