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
ManifoldCFExceptionpublic XMLDoc(String data) throws ManifoldCFException
data - xml to parseManifoldCFExceptionpublic XMLDoc(StringBuilder data) throws ManifoldCFException
data - xml to parseManifoldCFExceptionpublic XMLDoc(InputStream is) throws ManifoldCFException
is - InputStream of xml to parseManifoldCFExceptionpublic XMLDoc(XMLDoc oldDoc, Object parent) throws ManifoldCFException
ManifoldCFExceptionprotected 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
ManifoldCFExceptionpublic String getXMLNoEntityPreamble() throws ManifoldCFException
ManifoldCFExceptionpublic byte[] toByteArray()
throws ManifoldCFException
ManifoldCFExceptionpublic 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