private void addNodeAndDaughtersToXML( ENode node, BufferedWriter writer, int level, HashMap<String, NewRDPParserFileLine> rdpMap ) throws Exception
	{
		
		String tabString = "";
		
		for( int x=0; x <= level; x++ )
			tabString += "\t";
		
		String taxaName = "" + node.getLevel();
		String rank = null;
		String commonName = null;
		//String phylaName = null;
		
		if( rdpMap != null )
		{
			NewRDPParserFileLine line = rdpMap.get( node.getNodeName() );
			
			if( line != null)
			{
				NewRDPNode rdpNode = line.getLowestNodeAtThreshold(RDP_THRESHOLD);
				taxaName = rdpNode.getTaxaName() + " " + taxaName;
				rank = line.getLowestRankThreshold(RDP_THRESHOLD);
				commonName = tabString + "\t<common_name>" + line.getSummaryStringNoScore(50, 2)+"</common_name>\n";
				//NewRDPNode phylaNode = line.getTaxaMap().get(NewRDPParserFileLine.PHYLUM);
				
				//if( phylaNode != null)
				//	phylaName = tabString + "\t<accession>" + phylaNode.getTaxaName() + "</accession>\n";
			}
				
		}
		
		writer.write(tabString + "<clade>\n");
		
		//if( phylaName != null)
		//	writer.write(phylaName);
		writer.write( tabString + "\t<name>" + node.getNodeName() 
				+ "(" + node.getNumOfSequencesAtTips() + "seqs) level " + node.getLevel() +"</name>\n");
		
		if( level > 1 )
		{
			double branchLength = LEVELS[level-1] - LEVELS[level];
			writer.write(tabString + "\t<branch_length>" + branchLength +  "</branch_length>\n");
		}
		else
		{
			double branchLength = 0.01;
			writer.write(tabString + "\t<branch_length>" + branchLength +  "</branch_length>\n");
		}
		
		writer.write(tabString + "\t<taxonomy>");
		// obviously, just a stub at this point
		
		
		writer.write(tabString + "\t<scientific_name>" + taxaName + "(" + rank + ")" +"</scientific_name>\n");
		
		if( commonName != null)
			writer.write(commonName);
		
		if( rank != null)
			writer.write(tabString + "\t<rank>" + rank + "</rank>\n");
		
		writer.write(tabString + "\t</taxonomy>\n");
		
		level++;
		
		for( ENode daughter: node.getDaughters() )
			addNodeAndDaughtersToXML(daughter, writer, level, rdpMap);
		
		writer.write(tabString + "</clade>\n");
	}