write xml to a new window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Faser

    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.serializeToSt ring(xmlDoc);
    //ow.document.ope n(' text/xml') same result
    ow.document.ope n('content-type: text/xml');
    ow.document.wri te(str);
    ow.document.clo se();


    Faser
    --
    FABIO SERRA
    *Questo testo deve essere valutato secondo il senso della RFC-3*
    Per rispondere in e-mail sostituire "invalid" con "faser"
    --------------------
  • Richard Cornford

    #2
    Re: write xml to a new window

    "Faser" <invalid@faser. net> wrote in message
    news:3fa676e9.2 6602943@News.CI S.DFN.DE...[color=blue]
    >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.serializeToSt ring(xmlDoc);
    > //ow.document.ope n(' text/xml') same result
    > ow.document.ope n('content-type: text/xml');
    > ow.document.wri te(str);
    > ow.document.clo se();[/color]

    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.


    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: write xml to a new window

      Richard Cornford wrote:[color=blue]
      > "Faser" <invalid@faser. net> wrote [...]:[color=green]
      >> Eg:
      >> ow = window.open("", "myWin");
      >> var s = new XMLSerializer() ;
      >> var str = s.serializeToSt ring(xmlDoc);
      >> //ow.document.ope n(' text/xml') same result
      >> ow.document.ope n('content-type: text/xml');
      >> ow.document.wri te(str);
      >> ow.document.clo se();[/color]
      >
      > 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.[/color]

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

      new DOMParser().par seFromString(
      new XMLSerializer() .serializeToStr ing(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

      Comment

      Working...