Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts

    Ie equivalent to XMLSerialize?

    I've got a wonder about whether there's any IE method to do the same as you do with this code in moz:
    Code:
    var xmlDoc=(new XMLSerializer).serializeToString(document);
    What I want here, is to get the entire, parsed, document tree, including xml declaration, xml-stylesheets, comments, doctype. You can use document.documentElement.outerHTML to get the html content, but you can't get the things before the html element that way. You can use document.all(index) to get the xml declaration, xml-stylesheets and comments. You can't get the doctype, however. Is there a way to get the doctype, at all, from a parsed document in ie?


    Also, XMLSerialize used that way sometimes throw a URI error. Do you have any idea why it would do that?
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    To answer my own post, I found out there existed a nice and easy way of getting it...
    Code:
    var i=0,source=[];
    do
        source.push(document.all[i].outerHTML||document.all[i].text)
    while(document.all[i++].nodeType!=1);
    source=source.join('\n');
    There - now I just wonder how to do the same in op7 and saf/konq.

    // Liorean, posting his 100th post on CF
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •