Ripley Rubio wrote:Formatting is ugly....BAH HUMBUG!
I've also tried w/out the usage of importNode method. I'm guessing it has to do with how I'm initializing my "newNode" element.
I'm also GUESSING that I just need two little lines of code which I'm having a hard time mentally arriving at - first line being the initialization of the node named after the string in elements[j], the second line being in append/insert beneath the "loopNode" element.
Paul Clapham wrote:Regardless of my suggestion that your problem had something to do with the type of node you were adding to, rather than the node you were adding? I'm going to suggest that again.
Thus I would need to append/insert "boolean1" as a child of "display".
Ripley Rubio wrote:I was able to append under the root - is there a reason why I cannot append under a deeper node?
William Brogden wrote:
Thus I would need to append/insert "boolean1" as a child of "display".
Are you trying to insert an Element named boolean1 having some Text Node child - or what?
What are you expecting the resulting XML chunk to look like when you are done?
Bill
Paul Clapham wrote:
Ripley Rubio wrote:I was able to append under the root - is there a reason why I cannot append under a deeper node?
Like I said, it depends on what the deeper node is. You can't append a node under a Text node, for example. That's why I suggested you should look at the node you're trying to insert under, not at the node you're trying to insert.
You might contemplate using something like
to test that.
1) Insert/append child start and end tags when at a Node at Xth level in the xml file (e.g. insert <misc></misc> under <display>)
2) Set the value for the final Node (e.g. <boolean1>true</boolean1> under <misc>)
Paul Clapham wrote:
You might contemplate using something like
to test that.
William Brogden wrote:If you will refer to the table in org.w3c.dom.Node javadocs that I pointed you to previously, you will see that:
Element Nodes have a null nodeValue - duh!
The only kind of Nodes with a non-null value are Attr, CDATASection, Comment and Text nodes.
Thats what we have been trying to tell you,
XML <thing>value</thing> is an Element node named "thing" with a Text node child which has the value "value".
Bill
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |