I've been using some code I threw together, does it work for you?
$.fn.xml = function () {return $.xml(this[0])} $.xml = function(xml) { // dump the xml back to html text if (!xml) return "" var res = "" var tag = xml.nodeName var showTheTag = tag.charAt(0) != "#" if (showTheTag) res += '<' + tag if (xml.hasAttributes()) { var attrs = xml.attributes for (var i = 0; i < attrs.length; i++){ var attr=attrs[i] if (attr.specified) res +=' ' + attr.name + '="' + attr.value + '"' } } if (showTheTag) res+= ">" if (xml.nodeType == 8){ res += "<!-- " + xml.nodeValue + " -->" } else if (xml.nodeValue != null){ res += xml.nodeValue } if (xml.hasChildNodes()) { var children = xml.childNodes for (var i = 0; i < children.length; i++){ var child = children[i] res += $.xml(child) } } if (showTheTag) res += '</' + tag + '>' return res } On 4/22/07, dropx <[EMAIL PROTECTED]> wrote:
Hi guys, i have a problem about DOM i hope some one can help me. problem; I get a xml file and manipulate it with javascript. As below I want to get the html text in the <x> tag as html. however, with i javascipt i can only read child by child but this is a problem because when the html text is too long i can not read child by child. <a> <x> <b>Some html text here</b> <a href="">Link</a> </x> </a> i need something like .html(); function of JQuery.... thanks for your help....
-- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ