473,396 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

write xml to a new window

Using Mozilla, I would like to open a new window and write an
XML string. I would like the XML is properly rendered, but any attempts
failed. The XML is always rendered as text and the page type is always
text/html.

Eg:
ow = window.open("","myWin");
var s = new XMLSerializer();
var str = s.serializeToString(xmlDoc);
//ow.document.open(' text/xml') same result
ow.document.open('content-type: text/xml');
ow.document.write(str);
ow.document.close();
Faser
--
FABIO SERRA
*Questo testo deve essere valutato secondo il senso della RFC-3*
Per rispondere in e-mail sostituire "invalid" con "faser"
--------------------
Jul 20 '05 #1
2 16242
"Faser" <in*****@faser.net> wrote in message
news:3f***************@News.CIS.DFN.DE...
Using Mozilla, I would like to open a new window and write an
XML string. I would like the XML is properly rendered, but
any attempts failed. The XML is always rendered as text and
the page type is always text/html.

Eg:
ow = window.open("","myWin");
var s = new XMLSerializer();
var str = s.serializeToString(xmlDoc);
//ow.document.open(' text/xml') same result
ow.document.open('content-type: text/xml');
ow.document.write(str);
ow.document.close();


Regardless of anything else, I think that you face a fundamental problem
in that the open, write and close methods are part of the W3C _HTML_
DOM. So if you manage to arrange that the document in the new window is
an XML document you still will never be able to document.write into its
contents.

Richard.
Jul 20 '05 #2
Richard Cornford wrote:
"Faser" <in*****@faser.net> wrote [...]:
Eg:
ow = window.open("","myWin");
var s = new XMLSerializer();
var str = s.serializeToString(xmlDoc);
//ow.document.open(' text/xml') same result
ow.document.open('content-type: text/xml');
ow.document.write(str);
ow.document.close();


Regardless of anything else, I think that you face a fundamental problem
in that the open, write and close methods are part of the W3C _HTML_
DOM. So if you manage to arrange that the document in the new window is
an XML document you still will never be able to document.write into its
contents.


But he can, of course, use the W3C Core DOM features to
build the document tree. The problem is the value the
XMLSerializer.serializeToString(...) method returns --
a string. DOMParser.parseFromString(..., "text/xml")
returns an XML document, maybe

new DOMParser().parseFromString(
new XMLSerializer().serializeToString(xmlDoc), "text/xml");

is what the OP is looking for. If not, he should explain
what he is trying to achieve, maybe one can find a solution
then.
PointedEars
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
1
by: Nat | last post by:
Hi I have following code: ----------------- protected override void Render(HtmlTextWriter w) { if (helpString!=null) { w.Write("<span class='tooltipiconouter'><img title =...
2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
2
by: Jenny | last post by:
In the code below, I can write html content var t='<body BGCOLOR=blue>' for a new window. But if it contains javascript, such as var t='<body onload="window.open('new1.html')">', this code will...
7
by: Remi Bastide | last post by:
I'm trying to open a blank window and write a message in it. The following page works as expected in IE, but in Firefox the message is not written: <HTML> <HEAD> <TITLE>Document.write...
2
by: Adam | last post by:
This is frustrating me. Opening IE displays the following code fine. When I open a new window the code no longer works. All the HTML is overwritten with the first document.write statement. Tried...
4
by: Nat | last post by:
Help, I have following code: ----------------------------------------------------- protected override void Render(HtmlTextWriter w) { if (helpString!=null) { w.write("<span...
1
by: Angelos | last post by:
Hello there, I am very new to Javascript and before I explain what I want I'll tell you in a few words that I am trying to make a button on a WYSIWYG text editor (RichArea) that previews on a...
2
by: Steve | last post by:
I want to open a window that has been pre-formatted with a table and then write rows to the table. The pre-formatted url is named budget.html and the body looks like this: <body> <h1...
8
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.