I want to construct this XML file:
<root>
<data>
<track src="123456">
<desc id="1" mt="audio/mp3" ra="24" dr="221" nv="10005761">
Madonna - La Isla Bonita
</desc>
<clipdata>PD94bWwgdmVyc2lvbj0iMS4wIiBlb</clipdata>
</track>
</data>
<completed/>
</root
This is some part of the code:
this.xml.startElement("", "", Const.XML_ROOT, atts);
this.xml.startElement("", "", Const.XML_DATA, atts);
atts.clear();
atts.addAttribute("", "", "src", Const.XML_CDATA, "123456");
this.xml.startElement("", "", Const.XML_TRACK, atts);
atts2.addAttribute("", "", "id", Const.XML_CDATA, "1");
atts2.addAttribute("", "", "mt", Const.XML_CDATA, "audio/mp3");
atts2.addAttribute("", "", "ra", Const.XML_CDATA, "24");
atts2.addAttribute("", "", "dr", Const.XML_CDATA, "221");
atts2.addAttribute("", "", "nv", Const.XML_CDATA, "10005761");
this.xml.startElement("", "", "desc", atts2);
addCharacters(attsEmpty, "desc", "Madonna - La Isla Bonita");
this.xml.endElement("", "", "desc");
addCharacters(attsEmpty, "clipdata", "PD94bWwgdmVyc2lvbj0iMS4wIiBlb");
this.xml.endElement("", "", Const.XML_TRACK);
this.xml.endElement("", "", Const.XML_DATA);
addCompleted();
this.xml.endElement("", "", Const.XML_ROOT);
My problem is that I get this( I don’t want the song to apear inside another desc /desc). What should I need to change to get the correct XML ? Thanks.
<root>
<data>
<track src="123456">
<desc id="1" mt="audio/mp3" ra="24" dr="221" nv="10005761">
<desc>Madonna - La Isla Bonita</desc>
</desc>
<clipdata>PD94bWwgdmVyc2lvbj0iMS4wIiBlb</clipdata>
</track>
</data>
<completed/>
</root>
My bad, I had another startElement(desc) inside my addCharacters() function, that was causing the duplicate “desc” tag