www.webdeveloper.com
Results 1 to 4 of 4

Thread: XmlSerializer for IE ??

  1. #1
    Join Date
    Jul 2008
    Posts
    21

    XmlSerializer for IE ??

    Hello,

    Code:
    var xmlstring = '<?xml version="1.0"?>\
    <root>\
    	<data>\
    		<row>\
    			<cell>Captain</cell>\
    			<cell>Bryophyllum</cell>\
    			<cell>Zucchini</cell>\
    		</row>\
    	</data>\
    </root>';
    var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");
    Code:
    var string = (new XMLSerializer()).serializeToString(xmlobject);
    alert(string);
    this part of code ust works for mozilla firefox. And it is exactly what i need.
    Is there any solution for IE??

    I have xml like
    Code:
    <item id='content' method='clear'>
      <span>
      <h1>Hallo Titel</h1>
      <p>Hallo Content</p>
      </span>
    </item>
    and i need to write the whole content of item into an part of my website
    (tagged with an id like "content")

    Google is not my friend as it doesnt want to help me :/

  2. #2
    Join Date
    May 2003
    Location
    Between Baltimore and DC
    Posts
    3,579
    Is this what you were after?

    http://www.pascarello.com/TestHTMLXMLfromServer.htm

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

  3. #3
    Join Date
    Mar 2007
    Location
    Athens, Greece
    Posts
    177
    Hi,

    I think this recent post is relevat too (XML to String and vise versa with JS):

    http://www.webdeveloper.com/forum/sh...d.php?t=124577

    Cheers!

    Kostas
    K. Zotos online portfolio (3D, Web, Programming): http://www.in3d.eu/

  4. #4
    Join Date
    Jul 2008
    Posts
    21
    it is to easy to be true Oo

    Code:
    function xml2Str(xmlNode)
    {
      try {
        // Gecko-based browsers, Safari, Opera.
        return (new XMLSerializer()).serializeToString(xmlNode);
      }
      catch (e) {
        try {
          // Internet Explorer.
          return xmlNode.xml;
        }
        catch (e)
        {//Strange Browser ??
         alert('Xmlserializer not supported');
        }
      }
      return false;
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles