BigBug
BigBug

Reputation: 6290

javascript xml child node

How is this done?

i read about it here: CDATA I've tried:

    var XML = document.createElement("testing");
    var NodeSystemOut = document.createElement("system-out");
    var cdata = document.createCDATASection
    ('<p>Good relations have I with the Wookies</p>');
    NodeSystem.appendChild(cdata);
    XML.appendChild(NodeSystem); 

but this does not work.

any ideas? javascript noob

Upvotes: 0

Views: 127

Answers (1)

McDowell
McDowell

Reputation: 108969

Is there a newline in your runtime code?

var cdata = document.createCDATASection
('<p>Good relations have I with the Wookies</p>');

Check that your JavaScript engine doesn't interpret these as two separate expressions. This is a perfectly legal line of JavaScript:

("");

Confusingly, JavaScript supports implicit semicolon expression delimiters.

So, the engine might be assigning cdata to a function reference:

var cdata = document.createCDATASection;

Upvotes: 1

Related Questions