I’m parsing an XML file through Java, and am able to parse through Nodes in the XML file that appear as:
<name><given>familyName</given></name>
by using code such as the snippet shown below:
NodeList givenElmntLst = firstElement.getElementsByTagName("given");
Element givenNmElmnt = (Element) givenElmntLst.item(0);
NodeList fstNm = givenNmElmnt.getChildNodes();
String given = ((Node) fstNm.item(0)).getNodeValue();
but I am unable to read attributes that are formatted as such:
<birthTime value="19230101"/>
How should I be reading values such as the one above differently? Thanks in advance.
i’m assuming your using the
org.w3c.dompackage…try something like this: