public class XMLDoc
extends java.lang.Object
XMLException| Constructor and Description |
|---|
XMLDoc()
A non-initialized XMLDoc.
|
XMLDoc(java.lang.String systemid,
boolean validating,
boolean namespaceAware,
boolean expandEntities)
Reads and parses the XML document.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.StringBuffer |
getErrors()
Gets a human-readable validation error report
if errors were found in the XML,
otherwise returns an empty StringBuffer.
|
java.lang.StringBuffer |
getWarnings()
Gets a human-readable validation warning report
if warnings were found in the XML,
otherwise returns an empty StringBuffer.
|
boolean |
getXmlBoolean(java.lang.String xpath)
Retrieves a single boolean from an XML document.
|
org.w3c.dom.Element[] |
getXmlElements(int minnum,
int maxnum,
java.lang.String xpathspec)
Returns all Elements in an XML document that match
the specified partial xpath.
|
java.lang.String |
getXmlField(java.lang.String xpathspec)
Returns the first occurance of the field that matches the specified partial xpath, or a
an empty String if not found.
|
java.lang.String[] |
getXmlFields(int minnum,
int maxnum,
java.lang.String xpathspec)
Returns all strings in an XML document that match
the specified partial xpath.
|
java.lang.String[] |
getXmlFields(java.lang.String xpathspec)
Returns all strings in an XML document that match
the specified partial xpath, or a
zero-length array if none were found.
|
int |
getXmlInt(java.lang.String xpath)
Retrieves a single int from an XML document.
|
java.lang.String |
getXmlString(java.lang.String xpath)
Retrieves a single String from an XML document.
|
boolean |
hasErrors()
Determines whether the parser found any validation errors.
|
boolean |
hasWarnings()
Determines whether the parser found any validation warnings.
|
static void |
main(java.lang.String[] args)
Test driver.
|
void |
useXmlString(java.lang.String xmlString,
boolean validating,
boolean namespaceAware,
boolean expandEntities)
Reads and parses the XML string, which is then the source of the XML
used in this XMLDoc.
|
public XMLDoc(java.lang.String systemid,
boolean validating,
boolean namespaceAware,
boolean expandEntities)
throws XMLException
systemid - Specifies the input file or url: e.g,
file:///usr/local/nonesuch.xml
http://www.nonesuch.com/nonsuch.xml
validating - Is the parser to be validating?namespaceAware - Is the parser to be namespace aware?expandEntities - DESCRIPTIONXMLException - DESCRIPTIONpublic XMLDoc()
useXmlString(String, boolean,boolean,boolean).public static void main(java.lang.String[] args)
public void useXmlString(java.lang.String xmlString,
boolean validating,
boolean namespaceAware,
boolean expandEntities)
throws XMLException
XMLExceptionpublic int getXmlInt(java.lang.String xpath)
throws XMLException
getXmlFields for additional doc on
xpaths and on how occurances are counted.xpath - The partial xpath specification.XMLException - DESCRIPTIONpublic boolean getXmlBoolean(java.lang.String xpath)
throws XMLException
getXmlFields for additional doc on
xpaths and on how occurances are counted.xpath - The partial xpath specification.XMLException - DESCRIPTIONpublic java.lang.String getXmlString(java.lang.String xpath)
throws XMLException
getXmlFields for additional
doc on xpaths and on how occurances are counted.xpath - The partial xpath specification.XMLException - If the requested xpath was not found.public org.w3c.dom.Element[] getXmlElements(int minnum,
int maxnum,
java.lang.String xpathspec)
throws XMLException
"beta"
and the xml document contains:
<beta>
b1
<gamma> ggg </gamma>
b2
<iota> iii </iota>
b3
</beta>
the returned string will be "b1gggb2iiib3".
minnum - Minimum number of times xpathspec must be found.maxnum - Maximum number of times xpathspec must be found.xpathspec - the partial xpath specification; see above.XMLException - if the minnum or maxnum constraints are violated.public java.lang.String[] getXmlFields(int minnum,
int maxnum,
java.lang.String xpathspec)
throws XMLException
"beta"
and the xml document contains:
<beta>
b1
<gamma> ggg </gamma>
b2
<iota> iii </iota>
b3
</beta>
the returned string will be "b1gggb2iiib3".
minnum - Minimum number of times xpathspec must be found.maxnum - Maximum number of times xpathspec must be found.xpathspec - the partial xpath specification; see above.XMLException - if the minnum or maxnum constraints are violated.public java.lang.String[] getXmlFields(java.lang.String xpathspec)
xpathspec - the partial xpath specification.public java.lang.String getXmlField(java.lang.String xpathspec)
xpathspec - the partial xpath specification.public boolean hasErrors()
getErrors()public boolean hasWarnings()
getWarnings()public java.lang.StringBuffer getErrors()
hasErrors()public java.lang.StringBuffer getWarnings()
hasWarnings()