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 7019365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:10:24+00:00 2026-05-27T23:10:24+00:00

in Opera when I serialize an xml doc, it returns the string with the

  • 0

in Opera when I serialize an xml doc, it returns the string with the XML Declaration added to it. In Firefox and Chrome this dose not occur, and i would like Opera to return same results as Firefox and Chrome.

http://jsfiddle.net/superbDeveloper/Qst5e/9/ (JavaScript Code below)

JavaScript Code

//test xml serializer
var s = new XMLSerializer();  
var d = document;  
var str = s.serializeToString(d);  
console.log("1)  serializeToString "); 
console.log(str);

Results in Firefox

1) serializeToString
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta content="text/html; charset=UTF-8" http-equiv="content-type" /> <title> - jsFiddle demo by superbDeveloper</title> <script src="/js/lib/mootools-core-1.4.2-full-nocompat.js" type="text/javascript"></script> <link href="/css/normalize.css" type="text/css" rel="stylesheet" /> <link href="/css/result-light.css" type="text/css" rel="stylesheet" /> <style type="text/css"> </style>.....

Results in Opera

1)  serializeToString 
<?xml version="1.0"?><html><head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
  <title> - jsFiddle demo</title>

  <script type="text/javascript" src="/js/lib/mootools-core-1.4.2-full-nocompat.js"/>

  <link rel="stylesheet" type="text/css" href="/css/normalize.css"/>
  <link rel="stylesheet" type="text/css" href="/css/result-light.css"/>

  <style type="text/css">

  </style>...

Notice the XML Declaration <?xml version="1.0"?> has being added in Opera browser. Is there a way of stoping Opera from adding the XML Declaration? or how can one remove the XML Declaration? I thought of using substring but its not really an elegant solution.

  • 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-27T23:10:24+00:00Added an answer on May 27, 2026 at 11:10 pm

    Well, at this point what you have is a string, so using string methods is as elegant as it gets 🙂

    I’m not aware of any other way to do it.

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

Sidebar

Related Questions

works on safari/firefox/chrome/opera for mac + pc. But not for safari iPhone. error occurred
This works in modern Chrome/Firefox/Opera but fails in IE8. Haven't tried it in IE9.
Sound doesn't work with Firefox or Opera, only Chrome. I wonder if it's a
I have a page which appears just fine in FireFox / Chrome / Opera
Firefox and Opera seem to put articles after each other while Chrome gives a
This is happening in Opera 11, Firefox 3.6.13, and IE 8. On all of
this displays fine in FF,Opera, IE9, but in Chrome, the images don't display due
In Firefox/Safari/Chrome/Opera - the search bar and 4 sliders (from the page linked above)
I'm designing a new newsletter which looks great in Opera, Firefox and Chrome, but
Do different browsers (Firefox/Safari/IE/Opera) have different limits on the length of the name attribute

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.