|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.xml.XMLDoc
public class XMLDoc
Reads and parses an XML document.
XMLException
Constructor Summary | |
---|---|
XMLDoc()
A non-initialized XMLDoc. |
|
XMLDoc(String systemid,
boolean validating,
boolean namespaceAware,
boolean expandEntities)
Reads and parses the XML document. |
Method Summary | |
---|---|
StringBuffer |
getErrors()
Gets a human-readable validation error report if errors were found in the XML, otherwise returns an empty StringBuffer. |
StringBuffer |
getWarnings()
Gets a human-readable validation warning report if warnings were found in the XML, otherwise returns an empty StringBuffer. |
boolean |
getXmlBoolean(String xpath)
Retrieves a single boolean from an XML document. |
Element[] |
getXmlElements(int minnum,
int maxnum,
String xpathspec)
Returns all Elements in an XML document that match the specified partial xpath. |
String |
getXmlField(String xpathspec)
Returns the first occurance of the field that matches the specified partial xpath, or a an empty String if not found. |
String[] |
getXmlFields(int minnum,
int maxnum,
String xpathspec)
Returns all strings in an XML document that match the specified partial xpath. |
String[] |
getXmlFields(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(String xpath)
Retrieves a single int from an XML document. |
String |
getXmlString(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(String[] args)
Test driver. |
void |
useXmlString(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLDoc(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
- DESCRIPTION
XMLException
- DESCRIPTIONpublic XMLDoc()
useXmlString(String, boolean,boolean,boolean)
.
Method Detail |
---|
public static void main(String[] args)
public void useXmlString(String xmlString, boolean validating, boolean namespaceAware, boolean expandEntities) throws XMLException
XMLException
public int getXmlInt(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(String xpath) throws XMLException
getXmlFields
for additional doc on
xpaths and on how occurances are counted.
xpath
- The partial xpath specification.
XMLException
- DESCRIPTIONpublic String getXmlString(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 Element[] getXmlElements(int minnum, int maxnum, 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 String[] getXmlFields(int minnum, int maxnum, 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 String[] getXmlFields(String xpathspec)
xpathspec
- the partial xpath specification.
public String getXmlField(String xpathspec)
xpathspec
- the partial xpath specification.
public boolean hasErrors()
getErrors()
public boolean hasWarnings()
getWarnings()
public StringBuffer getErrors()
hasErrors()
public StringBuffer getWarnings()
hasWarnings()
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |