Distort XML format

PrivatePilot

New Member
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 \[code\]<tgroup>\[/code\], \[code\]<table>\[/code\], \[code\]<row>\[/code\], \[code\]<tbody>\[/code\], etc. as seen below. \[code\]var str = "<txml> <table><tsnipp><tbody> <row> ... </row> </tbody> </tsnipp> </table> </txml>"\[/code\]Now I am creating a jQuery object using \[code\]$(str)\[/code\]. The \[code\]<tsnipp>\[/code\] element in the XML document is under the \[code\]<table>\[/code\] element; however, when inspecting the jQuery object using Firebug, I see it as above the \[code\]<table>\[/code\] element, and thus the \[code\]<tsnipp>\[/code\] is at the same level as the \[code\]<table>\[/code\], as opposed to being one of its children. I think jQuery itself organizes it that way because it thinks the \[code\]<table>\[/code\] element is an HTML element.By just changing \[code\]<table>\[/code\] to \[code\]<d_table>\[/code\], 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.
 
Back
Top