
January 13th, 2012, 01:18 PM
|
|
Registered User
|
|
Join Date: Jan 2012
Posts: 7
Time spent in forums: 1 h 41 m 10 sec
Reputation Power: 0
|
|
|
Xerces dom parse of lshw cdrom capability
Using xerces to dom parse the xml output from lshw on suse.
I am trying to parse the dvd-ram capability for the cdrom device.
I have the cdrom "node" line as an element:
<node id="cdrom" claimed="true" class="disk" handle="SCSI:02:00:00:00">
and within the node there are the capabilities:
<capabilities>
<capability id="removable" >support is removable</capability>
<capability id="audio" >Audio CD playback</capability>
<capability id="cd-r" >CD-R burning</capability>
<capability id="cd-rw" >CD-RW burning</capability>
<capability id="dvd" >DVD playback</capability>
<capability id="dvd-r" >DVD-R burning</capability>
<capability id="dvd-ram" >DVD-RAM burning</capability>
</capabilities>
so basically I do:
NodeList nl = element.getElementsByTagName("capability");
Then I loop thru the nodelist, I can find the capability where id="dvd-ram" but I can't seem to get the node value of "DVD-RAM burning", its null:
for (int i=0;i<nl.getLength();i++) {
el = (Element)nl.item(i);
if (el.getAttribute("id").equals("dvd-ram)) {
textVal = el.getNodeValue();
break;
}
}
|