Io questi metodi non č che li capisco bene.....prima di parlare dei target sto facendo una cosa ancora pił basilare....prendere delle stringhe contenute in un tag <drug>

codice:
<drug-interactions>
      <drug-interaction>
        <drug>DB01381</drug>
        <name>Ginkgo biloba</name>
        <description>Additive anticoagulant/antiplatelet effects may increase bleed risk. Concomitant therapy should be avoided.</description>
      </drug-interaction>
      <drug-interaction>
        <drug>DB00374</drug>
        <name>Treprostinil</name>
        <description>The prostacyclin analogue, Treprostinil, increases the risk of bleeding when combined with the anticoagulant, Lepirudin. Monitor for increased bleeding during concomitant thearpy. </description>
      </drug-interaction>
    </drug-interactions>
    <protein-sequences>
      <protein-sequence>
        <header>DB00001 sequence</header>
        <chain>LVYTDCTESGQNLCLCEGSNVCGQGNKCILGSDGEKNQCVTGEGTPKPQSHNDGDFEEIPEEYLQ</chain>
      </protein-sequence>
    </protein-sequences>
    <experimental-properties>
      <property>
        <kind>logP/hydrophobicity</kind>
        <value>-0.777</value>
        <source></source>
      </property>
      <property>
        <kind>Molecular Weight</kind>
        <value>6963.4250</value>
        <source></source>
      </property>
      <property>
        <kind>Molecular Formula</kind>
        <value>C287H440N80O110S6</value>
        <source></source>
      </property>
    </experimental-properties>
    <external-identifiers>
      <external-identifier>
        <resource>Drugs Product Database (DPD)</resource>
        <identifier>2240996</identifier>
      </external-identifier>
      <external-identifier>
        <resource>National Drug Code Directory</resource>
        <identifier>50419-150-57</identifier>
      </external-identifier>
      <external-identifier>
        <resource>PharmGKB</resource>
        <identifier>PA450195</identifier>
      </external-identifier>
      <external-identifier>
        <resource>UniProtKB</resource>
        <identifier>P01050</identifier>
      </external-identifier>
    </external-identifiers>
    <external-links>
      <external-link>
        <resource>Wikipedia</resource>
        <url>http://en.wikipedia.org/wiki/Lepirudin</url>
      </external-link>
      <external-link>
        <resource>RxList</resource>
        <url>http://www.rxlist.com/cgi/generic/lepirudin.htm</url>
      </external-link>
      <external-link>
        <resource>Drugs.com</resource>
        <url>http://www.drugs.com/cdi/lepirudin.html</url>
      </external-link>
    </external-links>
    <targets>
      <target partner="54">
        <actions>
          <action>inhibitor</action>
        </actions>
        <references># Turpie AG: Anticoagulants in acute coronary syndromes. Am J Cardiol. 1999 Sep 2;84(5A):2M-6M. "Pubmed":http://www.ncbi.nlm.nih.gov/pubmed/10505536&#xD;
# Warkentin TE: Venous thromboe

E ho scritto un codice simile a quello di esempio:

codice:
import java.io.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;



public class Prova{
	
	public static void main(String [] args)
	{
		
		try{
			File file = new File("drugbank.xml");
			DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
			Document doc = db.parse(file);
			doc.getDocumentElement().normalize();
			NodeList nodeLst = doc.getElementsByTagName("drug-interactions");
			
			
			for (int s = 0; s < nodeLst.getLength(); s++) {
				
			Node fstNode = nodeLst.item(s);
    
			if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
				
			Element fstElmnt = (Element) fstNode;
			NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("drug");
			Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
				
			NodeList fstNm = fstNmElmnt.getChildNodes();
		
			System.out.println("Drug id: "  + ((Node)fstNm.item(0)).getNodeValue());
				
				}
			}
		
		     }

		
		   catch(Exception e){e.printStackTrace();}
		   
	}
}
Ma ho un nullpointerException a
codice:
NodeList fstNm = fstNmElmnt.getChildNodes();
Non riesco a capire questo parsing...