0

Surprised that I could not find much on this, I don't think this is a dup (who knows anymore?...)

My PHP-generated HTML looks like this:

<!DOCTYPE html>
<html>
    <head>
        <title>Manipulate and Save XML</title>
    </head>
    <body>
        ...
        <script type="text/xml" id="xml-data"><?=$well_formed_xml?></script>
        ...
    </body>
</html>

My js app initializes like this:

var xml = $.parseXML($("#xml-data").html());
var $xml = $(xml);

Then, through actions taken by the user, this xml gets traversed, read, and manipulated. I would like to get the string of the manipulated xml to then send as a post to a server and initiate a file download dialog.

I've tried:

$xml.html()        // returns null
$xml.toString()    // returns "[object Object]"
xml.toString()     // returns "[object Document]"

Interesting to note: I first went to the jQuery manual page on parseXML, tried to follow the link to the XMLDocument pseudo/virtual type http://api.jquery.com/Types/#XMLDocument only to find that it was undocumented there (no section with id="XMLDocument").

Any ideas?

AndyPerlitch
  • 4,539
  • 5
  • 28
  • 43

0 Answers0