GetElementsByTagName returns namespace of parent node?

November 30

So, is this expected behaviour?
I have the case were we have a parent node that is basically an XSD:anyType. We then store XML fragments under this node. However, when searching and retrieving various fragments using getEelementsByTagName that do not have a namespace associated with them, the namespace of the parent is associated to the returned element?
Is there anyway to suppress this or is there a better way to search and retrieve particular nodes?
I am using the XDK shipped with JDeveloper



So, there is no default namespace specified. Here is the content of the XML:
<payload xmlns="">
<ns1:VacationRequestProcessRequest xmlns:ns1="">
<Errors xmlns=""/>
So, when grabbing a node with no namespace, it defaults to the parent nodes namespace. I have been able to rename the node with a different namespace, but it just makes things more complicated. Would be nice to get a plain node / fragment of an XML document.
Here is the code I am using to grab the node:
DOMParser parser = new DOMParser(); file =
XMLDocument doc;
InputStream is = new FileInputStream(file);
doc = parser.getDocument();
NodeList list = doc.getElementsByTagName("Location");
Element element = (Element)list.item(0);
The output I get from this is:
<Location xmlns="">kalwona</Location>
The elementToXMLString just uses the XMLPrintDriver.
So, I am kind of hoping I can copy a node with no associated namespace information related to it. Kind of like just leaving it alone if there is no namespace specified in the actual document. Any ideas on how to do this???

View 10 Replies


  1. macbook pro osx10.6.8 hdmi display on tv
  2. windonw 8 graphics card dw
  3. MacBook 5,4 windows
  4. cardumj
  5. lasteka
  6. reviewrwz
  7. spinx1l
  8. steel6s3
  9. killpi8
  10. ibooks 3.1 ipa
Copyrights 2019 Fcffair BigData Resource, All rights reserved