|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.xml.ParseXMLFile
This class represents short example how to parse XML file,
get XML nodes values and its values.
It implements method to save XML document to XML file too
Constructor Summary | |
ParseXMLFile()
Creates a new instance of ParseXMLFile |
Method Summary | |
static java.lang.String |
getElementValue(org.w3c.dom.Node elem)
Returns element value |
static void |
main(java.lang.String[] args)
Starts XML parsing example |
org.w3c.dom.Document |
parseFile(java.lang.String fileName)
Parses XML file and returns XML document. |
boolean |
saveXMLDocument(java.lang.String fileName,
org.w3c.dom.Document doc)
Saves XML Document into XML file. |
void |
writeDocumentToOutput(org.w3c.dom.Node node,
int indent)
Writes node and all child nodes into System.out |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ParseXMLFile()
Method Detail |
public static final java.lang.String getElementValue(org.w3c.dom.Node elem)
elem
- element (it is XML tag)
public void writeDocumentToOutput(org.w3c.dom.Node node, int indent)
node
- XML node from from XML tree wrom which will output statement startindent
- number of spaces used to indent outputpublic boolean saveXMLDocument(java.lang.String fileName, org.w3c.dom.Document doc)
fileName
- XML file namedoc
- XML document to save
public org.w3c.dom.Document parseFile(java.lang.String fileName)
fileName
- XML file to parse
public static void main(java.lang.String[] args)
args
- the command line arguments
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |