|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.ucsb.cs.jicos.services.external.XmlDocument
public class XmlDocument
| Field Summary | |
|---|---|
static java.lang.String |
CRLF
Line terminator. |
protected org.w3c.dom.Document |
document
|
protected java.lang.String |
xmlText
|
| Constructor Summary | |
|---|---|
XmlDocument()
No-argument constructor of XmlDocument. |
|
XmlDocument(org.w3c.dom.Element element)
Construct an XmlDocument from a DOM (XML) element. |
|
XmlDocument(ExternalData externalData)
Construct an XmlDocument on external data. |
|
XmlDocument(java.io.File file)
Construct an XmlDocument from a XML file. |
|
XmlDocument(java.util.List list)
Construct an XmlDocument from a list. |
|
XmlDocument(org.w3c.dom.Node rootNode)
Construct an XmlDocument from an XML node |
|
XmlDocument(java.lang.String xml)
Construct an XmlDocument from an XML-encoded string. |
|
XmlDocument(TaskExternal task,
java.lang.Object result)
Construct an XmlDocument from a Task, and it's result. |
|
XmlDocument(java.lang.Throwable exception)
Create an XML document from an exception. |
|
XmlDocument(XmlDocument xmlDocument)
Copy constructor. |
|
| Method Summary | |
|---|---|
boolean |
add(Invoice invoice)
|
java.lang.String[] |
getArray(java.lang.String xpathQuery)
Get an individual value from the document. |
org.w3c.dom.Document |
getDocument()
Get the raw XML (DOM - Document Object Model) document. |
org.w3c.dom.Element[] |
getElement(java.lang.String xpathQuery)
Get an individual value from the document. |
java.lang.String |
getText()
Get the text used to create the DOM. |
java.lang.String |
getValue(java.lang.String xpathQuery)
Get an individual value from the document. |
static void |
main(java.lang.String[] cmdLine)
|
boolean |
parse(java.io.File xmlFile)
Parse XML-encoded text. |
boolean |
parse(java.lang.String xmlString)
Parse XML-encoded text. |
ExternalData |
removeWrapper()
Get the data out of the (optional) wrapper. |
java.lang.String |
toHtmlString()
Convert the document to an XML-encoded string that can be interpreted as HTML. |
static java.lang.String |
toHtmlString(java.lang.Throwable exception)
Convert the exception to an XML-encoded string that can be interpreted as HTML. |
java.lang.String |
toString()
Convert the document to a "Java" string (class[member, [...]]). |
java.lang.String |
toVerboseString()
Convert the document to a (human readable) string. |
java.lang.String |
toXmlString()
Convert the document to an XML-encoded string. |
static java.lang.String |
toXmlString(java.lang.Throwable exception)
Convert the exception to an XML-encoded string. |
java.lang.String |
Transform(org.w3c.dom.Document xsltStyleSheet)
Convert the DOM object to a string using a particular stylesheet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CRLF
protected java.lang.String xmlText
protected org.w3c.dom.Document document
| Constructor Detail |
|---|
public XmlDocument()
public XmlDocument(java.lang.String xml)
throws org.xml.sax.SAXException,
java.io.IOException
xml - An XML-encoded string.
org.xml.sax.SAXException
java.io.IOException
public XmlDocument(java.io.File file)
throws org.xml.sax.SAXException,
java.io.IOException
file - File containing XML.
org.xml.sax.SAXException
java.io.IOException
public XmlDocument(TaskExternal task,
java.lang.Object result)
throws java.lang.Exception
task - A Jicos task.result - The result of a compute on the above task.
java.lang.Exceptionpublic XmlDocument(XmlDocument xmlDocument)
xmlDocument - An XmlDocument instance.public XmlDocument(org.w3c.dom.Node rootNode)
rootNode - A node in a DOM (XML) tree.public XmlDocument(ExternalData externalData)
externalData - External data - currently a XmlDocument or List.
java.lang.IllegalArgumentException - If the externalData cannot be converted.
public XmlDocument(java.util.List list)
throws java.lang.Exception
list - A list of key/value pairs.
java.lang.Exception - Catch-allcreateFromList(List)public XmlDocument(org.w3c.dom.Element element)
element - A DOM element.public XmlDocument(java.lang.Throwable exception)
exception - The badness that occurred.| Method Detail |
|---|
public java.lang.String getText()
public org.w3c.dom.Document getDocument()
public boolean add(Invoice invoice)
public boolean parse(java.io.File xmlFile)
throws org.xml.sax.SAXException,
java.io.IOException
xmlFile - File containing XML-encoded text.
true), or failure (false
).
org.xml.sax.SAXException
java.io.IOException
public boolean parse(java.lang.String xmlString)
throws org.xml.sax.SAXException,
java.io.IOException
xmlString - String containing XML-encoded text.
true), or failure (false
).
org.xml.sax.SAXException
java.io.IOExceptionpublic org.w3c.dom.Element[] getElement(java.lang.String xpathQuery)
(//) is not allowed.child::para[position()= n is
not allowed.(.../*)
.../child::para and .../para are
equivalent.
xpathQuery - An XPath query.
public java.lang.String getValue(java.lang.String xpathQuery)
* and // are not allowed.
/path/to/node selects the value of node./path/to/node/@attribute selects the value of the
attribute of node.
getValue in interface ExternalDataxpathQuery - An XPath query.
public java.lang.String[] getArray(java.lang.String xpathQuery)
* and // are not allowed.
/path/to/node selects the value of node./path/to/node/@attribute selects the value of the
attribute of node.
getArray in interface ExternalDataxpathQuery - An XPath query.
public ExternalData removeWrapper()
removeWrapper in interface ExternalDatapublic static java.lang.String toXmlString(java.lang.Throwable exception)
public java.lang.String toXmlString()
public static java.lang.String toHtmlString(java.lang.Throwable exception)
public java.lang.String toHtmlString()
< --> <"> --> >" --> "
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toVerboseString()
public java.lang.String Transform(org.w3c.dom.Document xsltStyleSheet)
xsltStyleSheet - The style sheet to use for the transformation.
public static void main(java.lang.String[] cmdLine)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||