Unable to get Name attribute of Childnode

.Q.

New Member
I have a XML file that looks like this:\[code\]<exist:result xmlns:exist="http://exist.sourceforge.net/NS/exist"><exist:collection name="/db/RCM" created="2013-03-24T09:37:34.957+05:30" owner="admin" group="dba" permissions="rwxrwxrwx"><exist:resource name="demo2.xml" created="2013-03-24T09:44:13.696+05:30" last-modified="2013-03-24T09:44:13.696+05:30" owner="guest" group="guest" permissions="rw-r--r--"/><exist:resource name="demo3.xml" created="2013-03-24T09:45:47.592+05:30" last-modified="2013-03-24T09:45:47.592+05:30" owner="guest" group="guest" permissions="rw-r--r--"/><exist:resource name="rcmdemo.xml" created="2013-03-25T11:36:45.659+05:30" last-modified="2013-03-25T11:36:45.659+05:30" owner="guest" group="guest" permissions="rw-r--r--"/><exist:resource name="rcmdemo2.xml" created="2013-03-25T11:47:03.564+05:30" last-modified="2013-03-25T11:47:03.564+05:30" owner="guest" group="guest" permissions="rw-r--r--"/></exist:collection></exist:result>\[/code\]I want to fetch the name of the XML files, so the output looks like this:\[code\]demo2.xmldemo3.xmlrcmdemo.xmlrcmdemo2.xml\[/code\]I have written the following code:\[code\]NodeList nodeList = doc.getElementsByTagName("exist:resource");for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); Node actualNode = n.getFirstChild(); if (actualNode != null) { System.out.println(actualNode.getNodeValue()); }}\[/code\]But it does not return the output that I want, where am I going wrong?
 
Back
Top