I ran into a problem developing on Blackberry. I use the KXML2 api for parsing XML (well, actually, I got another user's code to continue and fix, so I have to use this). The problem is the lack of cloning in java me, and I am having some difficulties when trying to deep copy the node. (I donβt want to go into details, but the fact is that I need to substitute data at certain html points, and for this there is an xml descriptor) So ..! :)
XMLElement childNode = node.getElement(ci);
This is the item I need to copy. XMLElement is a simple wrapper class, it doesn't matter, it contains the Element attribute and some useful methods.
Now what I want looks like something like this:
XMLElement newChildNode = childNode.clone();
Since there is no cloning in Java ME, there is no cloned interface, I cannot do this, and this only creates a link to the original element that I need to save by changing the new element:
XMLElement newChildNode = childNode;
Can anyone come up with a useful idea on how to create a deep copy of my childNode element? Thank you so much in advance!
source share