It´s me again with another XML related question ;)
So,basically,I now try to create a dynamic process for replacing XML sections.
Just to give you a short summary: First, I tried to overload a certain section inside a big XML with a smaller XML just containing an equally named section with other data.
Now,I build a GUI around this stuff and read out all possible nodes to be overloaded and save them inside a ComboBox for the user to choose.
When the user picks his node to be replaced, the application should then search for the corresponsing section inside XML number A,copy that one and import it into XML number B.
So far so good.But somehow, the element, I want to import into the other is ALWAYS empty, even though I read out the chosen node correctly(checked this one out with MANY System.out.prints ;) )
The idea is, that,no matter whereever inside the XML the wanted section is located, used to overload the other equally named section inside the second XML,the application is able to locate this section and import it.
Just to illustrate:
And now,the user gets all possible nodes provided by XML A inside a ComboBox to choose which section he wants to overload. Then, the application uses the name of this section to search inside XML B, retrieves the data and imports it inside XML A. For example the application locates the field "name", after being chosen, inside XML B and overrides the existing data in XML A ("Maier") with the data in XML B("Müller"). This means, the section to be retrieved from XML B doesn´t have to be the root node, but it might be!
Now, here´s my code so far:
You don´t have to look at all the comments I made inside the code ;)
As you can see, I tried a lot of print()-statements to find out, where the problem is.
And apparently, my Element is null??But I use the correct name for the node to locate it.
I just can´t figure out the problem...
Hopefully someone has an idea