I feel like this question has a really easy answer and I’m just overlooking it. I need to get a pointer to a piece of XML. I can get a pointer to the parent node and everything works but trying to get a pointer to a node that has no children just returns the value of that node.
Here’s an example:
<body>
<parentNode>
<subNode>value</subNode>
</parentNode>
</body>
So to get a pointer to “parentNode”, I would say something like this:
var parentNode = xml.parentNode;
If you trace that it would be the xml shown above without the body tags.
Below I will try to get a pointer to the subNode:
var subNode = xml.parentNode.subNode;
Tracing subNode would be just the value and there is no pointer to the original xml object, so editing the subNode var would only change its value, not the one in the original XML object.
How do I get a pointer to the subNode so it can be edited to change the original xml object?
Here is a code example :