50 pts.
 Fetch element using getElementsByTagName excluding the namespace
I have an XML code which fetches a node from one xml and creates a new xml out of it. the code is as follows, 
 parser = new DOMParser();
 parser.parse(new StringReader(xml));
 xmlSrcDoc = parser.getDocument();
 xmldoc.setXmlVersion("1.0"); // new xml doc
 xmldoc.setEncoding("UTF-8");
 Element e1 = xmldoc.createElement("config");
 e1.setAttribute("productVersion", "x.x");
 e1.setAttribute("xmlns:abc", "http://xmlns.efg.com/xyz");
 NodeList nl = xmlSrcDoc.getElementsByTagName("tag");
 Node e = nl.item(0);
 e1.appendChild(xmldoc.adoptNode(e));
 xmldoc.appendChild(e1);
snippet of the XML:
<?xml version="1.0" encoding="UTF-8"?>
<search:config productVersion="x.x" xmlns:abc="http://xmlns.efg.com/xyz">
<search:tag>
      <search:mno>
       ..................................
....................................
the new XML document created has the line 
<search:tag xmlns:abc="http://xmlns.efg.com/xyz"> instead of 
<search:tag> 
is their a way to avoid the namespace getting included?
  


Software/Hardware used:
ASKED: April 23, 2010  9:30 AM
UPDATED: April 23, 2010  3:37 PM

Answer Wiki:
Last Wiki Answer Submitted:  Be the first to answer this question.
All Answer Wiki Contributors:  Be the first to answer this question.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _