This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Hi, I'm currently doing some XML maninupalation using Java built in tooling.
I have a (non validating) configuration file:
Note that the first element does not have a tail element whereas the second does. In the program I retrieve the template elements by doing:
returning a list with all the elements. The elements are stored in some wrapper objects. Which in turn are stored in a list. Iterating over the list I search in stored elements:
I hope your are still with me: the first template does not contain a tail element, the second does. But the code above, happily retrieves the tail element of the stored element's sibbling, which is not the desired behavior: It should return null.
Line above should give null ERRROR (?) Is there a way to make this happen? I tried the xerces and the Java 1.5 implementation, both give same results. Is this the documented behavior? Or should I set a setting on the DocumentBuilderFactory?
Thank you for your time and kind regards, Jeroen. [ June 10, 2008: Message edited by: jeroen dijkmeijer ]
Joined: Sep 26, 2003
found it, need to drop the slashes. It's behavior is according the specs.