mardi 4 août 2015

Javascript Create XML DOM - The Node Object

I have a simple question: How can I create a new Node from scratch?

Here is my situation:

I need to build an XML Structure from an object list.

I have a method ToElement on each control ( Textbox, combobox, ...) and I want this method to return a XML DOM Node object to use the appendChild() and his parent.

I'm not able to find how to create a Node object from scratch I know that I can use an XMLDocument.createElement but this method return an HTMLElement and you can't use appendChild with this kind of element.

nodeObject.appendChild(HTMLelement) //** Not Working**

Is there a way to convert an HTMLElement to a Node ? The only way that I found to create an element it's from a XMLDocument:

XMLDocument.createElement // (Return a new HTMLElement)

Aucun commentaire:

Enregistrer un commentaire