Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6177769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:20:04+00:00 2026-05-24T00:20:04+00:00

Is there a way to do it(serialization of HTML DOM into XML) in IE

  • 0

Is there a way to do it(serialization of HTML DOM into XML) in IE 8 or any other older version of IE.
In firefox :

var xmlString = new XMLSerializer().serializeToString( doc );

does it.
I haven’t tried it, though.

XMLSerializer causes error in IE 8, that it is not defined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:20:05+00:00Added an answer on May 24, 2026 at 12:20 am
    var objSerializeDOM = {
    
    //Variable to hold generated XML.   
    msg : "",   
    
    serializeDOM : function() {
    
        dv = document.createElement('div'); // create dynamically div tag
        dv.setAttribute('id', "lyr1"); // give id to it
        dv.className = "top"; // set the style classname
        // set the inner styling of the div tag
        dv.style.position = "absolute";
    
        // set the html content inside the div tag
        dv.innerHTML = "<input type='button' value='Serialize' onClick='objSerializeDOM.createXML()'/>"
        "<br>";
    
        // finally add the div id to ur form
        document.body.insertBefore(dv, document.body.firstChild);
    
    },
    
    /**
     * XML creation takes place here.
     */
    createXML : function() {
    
        objSerializeDOM.msg += "";
        objSerializeDOM.msg += "<?xml version='1.0' encoding='UTF-8'?>\n\n";
        // Get all the forms in a document.
        var forms = document.forms;
    
        for ( var i = 0; i < forms.length; i++) {
            // Get all the elements on per form basis.
            elements = document.forms[i].elements;
            objSerializeDOM.msg += "<FORM name=\"" + forms[i].name + "\" method=\""
                    + forms[i].method + "\" action=\"" + forms[i].action + "\">\n\n";
            for ( var j = 0; j < elements.length; j++) {
                objSerializeDOM.msg += "    <" + elements[j].tagName + "  type=\""
                        + elements[j].type + "\"" + "  name=\""
                        + elements[j].name + "\"" + "   Value =\""
                        + elements[j].value + "\"  />\n";
            }
            alert(document.forms[i].elements[1].event);
        }
        objSerializeDOM.msg += "\n\n</FORM>\n\n";
        alert(objSerializeDOM.msg);
        objSerializeDOM.writeToFile(objSerializeDOM.msg);
    },
    
    /**
     * Writes the msg to file at pre-specified location.
     * @param msg
     *          the XML file created.
     */
    writeToFile : function(msg) {
       var fso  = new ActiveXObject("Scripting.FileSystemObject");
       var fh = fso.CreateTextFile("c:\\myXML.xml", true);
       fh.WriteLine(msg);
       fh.Close();
    }
    

    };

    objSerializeDOM.serializeDOM();

    I wrote this JS, I run this javascript using GreaseMonkey4IE. This simply puts a button on every page of the domain you specify in GM4IE. On click of that button it will parse the HTML document and create an XML file. It will also display the same as an alert first and will save the XML in your local drive on path specified.
    There a still many improvements I am planning to do, but yes it works and may be give you guys an idea.
    The program is self-explanatory, I hope.

    please have a look here How to get Events associated with DOM elements?

    Thanks

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What ways there are for doing a one way XML serialization in .Net? XmlSerializer
Is there a clever way of adding XML serialization instructions without modifying the serialized
Just like the way we save the instance variables using serialization, is there any
I am using JAXB2 to serialize object to xml. Is there any way how
Is there a way to customize XML serialization in JAXB, in the same way
Is there any way to update cookies across folders in PHP? For example, consider
This code: println(new XStream.toXML(List(1,2,3))) produces this XML: <scala.coloncolon serialization=custom> <unserializable-parents/> <scala.coloncolon> <int>1</int> <int>2</int> <int>3</int>
When serializing an object using the System.Runtime.Serialization.Json.DataContractJsonSerializer , is there a way to set
Is there a way to conditionally exclude items from JSON serialization? I'm using C#
Is there any way to conditionally specify EmitDefaultValue at runtime for the DataContractSerializer in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.