I am using jQuery object to append elements and modify the values of an XML document, which I am initializing using a XML string which has nodes such as <tgroup>
, <table>
, <row>
, <tbody>
, etc. as seen below.
var str = "<txml> <table><tsnipp><tbody> <row> ... </row> </tbody> </tsnipp> </table> </txml>"
Now I am creating a jQuery object using $(str)
. The <tsnipp>
element in the XML document is under the <table>
element; however, when inspecting the jQuery object using Firebug, I see it as above the <table>
element, and thus the <tsnipp>
is at the same level as the <table>
, as opposed to being one of its children. I think jQuery itself organizes it that way because it thinks the <table>
element is an HTML element.
By just changing <table>
to <d_table>
, jQuery does the right thing.
I wanted to use jQuery to manipulate the object as it is easier to manipulate as a DOM object. However, converting it into a string and then to a jQuery object will require a lot of regular expressions to replace certain strings into others, back and forth.