So the method of "org.w3c.dom.Element.getElementsByTagNameNS()" can not get any NodeList.
I am looking at the JavaDocs for Element in Java 1.5 - I see no reason why this would not work. What happens when you try the special value "*" to match any NS?
Joined: Apr 15, 2002
I was not tring to use "*" to match everything.
I'm using J2sdk1.4. In its API document, it describle this method as below. So I think there should be an existed solution for this issue.
========================================== Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the order in which they are encountered in a preorder traversal of this Element tree. Documents which do not support the "XML" feature will permit only the DOM Level 1 calls for creating/setting elements and attributes. Hence, if you specify a non-null namespace URI, these DOMs will never find a matching node.
Parameters: namespaceURI - The namespace URI of the elements to match on. The special value "*" matches all namespaces. localName - The local name of the elements to match on. The special value "*" matches all local names. Returns: A new NodeList object containing all the matched Elements. Since: DOM Level 2
Author and all-around good cowpoke
Joined: Mar 22, 2000
I must be getting dense with old age because I still cant figure out exactly what your problem is. Here are the questions which occur to me:
1. Does your XML document even use namespaces? 2. What is the code used to get a NodeList in the old (sdk 1.3) code? 3. What is the code you are trying now with sdk 1.4? 4. What did you expect to happen and what actually happened?
The question seems to be saying that some behaviour changed between Java 1.3 and Java 1.4, and wants to know how to fix it by doing some specific thing.
I for one would like to see an example of this behaviour. Sample code, sample input, results in the two versions with differences pointed out. It's pretty hard to provide a solution to the problem until you have a description of the problem.
subject: How to substitue a DOM L2 method for getElementsByTagNameNS