how to resolve org.xml.sax.SAXException
<p>I am getting error: </p>

<pre><code>org.xml.sax.SAXException: expected &lt;/taxonomy&gt;
</code></pre>

<p>I am creating xml for creating parent - child relationship. 
My code : </p>

<pre><code>public void createXML(Map mp) throws SAXException, TransformerConfigurationException{

System.out.println("the size of the mp is              :   "+mp.size());
String parent,child,li,child1;
  li = "li";
Set keySetFinal = mp.keySet();
System.out.println("the size of the key set is : "+keySetFinal.size());
// Get Iterator of keySet
Iterator&lt;String&gt; iterator = keySetFinal.iterator(); 
XMLDocument xml = new XMLDocument(new StreamResult("C:\\Program Files\\Notepad++\\XML_FOR_TAX.xml"), false, 4, null);
  xml.startDocument();
  {
    try {
        xml.startElement("taxonomy");

      while(iterator.hasNext()){          
            //  System.out.println("loop started");
            parent = iterator.next();
            NodeList childNodes = (NodeList) mp.get(parent);
            System.out.println("the size of the child list for this iteration is: "+ childNodes.getLength());
            xml.addElement("li", parent);
            System.out.println("key in the xml creation function is: "+parent);

                for (int i = 0; i &lt; childNodes.getLength(); i++){
                     if (childNodes.item(i).getNodeType() == Node.ELEMENT_NODE){
                     Element child_1 = (Element)childNodes.item(i); 
                     child1 = child_1.getAttribute("name");
                     System.out.println("child now is : "+child1);
                     xml.startElement("ul");
                     xml.addElement("li", child1);
                     xml.endElement("ul");
                     }                     
                     }
                xml.endElement("li");
      }



    }catch (SAXException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
    xml.endElement("taxonomy"); 
            }
      xml.endDocument();
  }
</code></pre>
