Fetch element using getElementsByTagName excluding the namespace

50 pts.
Tags:
Fetch
nodes
XML
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?
  

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: