You may if you wish adapt the DOM processing code given in
the lectures (see
here).
But you should be selective
in what information you extract. For example removing
the line System.out.println(node.getNodeName())
and replacing the unconditional
System.out.println(node.getNodeValue()) with:
if(node.getNodeType() == Node.TEXT_NODE &&
node.getParentNode().getNodeName().equals("degree")) {
System.out.println(node.getNodeValue()) ;
}
would print only text from inside elements of type
degree. Generally a single process()
method could extract a few kinds of information,
or a few different process()-like methods could be
called one after the other to extract different kinds of information.