XML generation

Discussion in 'XML' started by Peter Laman, May 5, 2008.

  1. Peter Laman

    Peter Laman Guest

    The XML DOM implementation extends the XML document object with an
    "XML" property to retrieve the textual form of the document. This
    causes my javascript code not to work with Firefox, because the XML
    DOM standard doesn't have that property. But how else can I get the
    XML doc's text?
    Peter Laman, May 5, 2008
    #1
    1. Advertising

  2. Peter Laman wrote:
    > The XML DOM implementation extends the XML document object with an
    > "XML" property to retrieve the textual form of the document. This
    > causes my javascript code not to work with Firefox, because the XML
    > DOM standard doesn't have that property. But how else can I get the
    > XML doc's text?


    I am not sure I understand what you are asking about. If you use the
    xmlNode.xml property with MSXML in IE then the equivalent with Mozilla is
    new XMLSerializer().serializeToString(xmlNode)

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, May 5, 2008
    #2
    1. Advertising

  3. Peter Laman wrote:
    > But how else can I get the XML doc's text?


    Why do you think you need the document's text representation? Why can't
    you retrieve the information you need from the DOM?
    Joseph J. Kesselman, May 5, 2008
    #3
  4. I should say that, if you do need to generate XML source (probably not
    true in browser code, but may be true in the server or standalone apps):
    DOM Level 3 and later has an optional load/save module. If you don't
    have that available you may be able to put the DOM through an XSLT
    stylesheet or JAXP serializer. Check the documentation for your
    environment to see what's available, or load up one of the available
    libraries.

    But the right place to begin is with the problem you're trying to solve.
    If you're working with a DOM in a brower, it would be somewhat unusual
    for you to need to see the XML via anything but the browser's "view
    source" or by looking at the source file some other way... except
    possibly as a debugging aid.
    Joseph J. Kesselman, May 5, 2008
    #4
  5. Peter Laman

    Peter Laman Guest

    On May 5, 9:38 pm, "Joseph J. Kesselman" <>
    wrote:
    > I should say that, if you do need to generate XML source (probably not
    > true in browser code, but may be true in the server or standalone apps):
    > DOM Level 3 and later has an optional load/save module. If you don't
    > have that available you may be able to put the DOM through an XSLT
    > stylesheet or JAXP serializer. Check the documentation for your
    > environment to see what's available, or load up one of the available
    > libraries.
    >
    > But the right place to begin is with the problem you're trying to solve.
    > If you're working with a DOM in a brower, it would be somewhat unusual
    > for you to need to see the XML via anything but the browser's "view
    > source" or by looking at the source file some other way... except
    > possibly as a debugging aid.


    What I'm trying to do is to have the user edit a table's content which
    comes from the server in XML format. The scripts parses the XML string
    into DOM and manipulates the DOM as the user edits its content. The
    aim is to minimize interaction with the server. So all the editing is
    done locally using JavaScript. If the user confirms the edits made, I
    want to post the changed XML code to the server and for that I want to
    generate the XML text from the DOM document.
    Peter Laman, May 6, 2008
    #5
  6. Peter Laman

    Peter Laman Guest

    On May 5, 5:20 pm, Martin Honnen <> wrote:
    > Peter Laman wrote:
    > > The XML DOM implementation extends the XML document object with an
    > > "XML" property to retrieve the textual form of the document. This
    > > causes my javascript code not to work with Firefox, because the XML
    > > DOM standard doesn't have that property. But how else can I get the
    > > XML doc's text?

    >
    > I am not sure I understand what you are asking about. If you use the
    > xmlNode.xml property with MSXML in IE then the equivalent with Mozilla is
    > new XMLSerializer().serializeToString(xmlNode)
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/


    Thanks Martin, that does the trick!
    Peter Laman, May 6, 2008
    #6
  7. Ah. OK, that's reasonable.
    Joseph J. Kesselman, May 6, 2008
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hugo Ferreira
    Replies:
    0
    Views:
    363
    Hugo Ferreira
    Jul 14, 2004
  2. =?Utf-8?B?QmFyZW4=?=

    HTML Generation from XML

    =?Utf-8?B?QmFyZW4=?=, May 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    410
    =?Utf-8?B?QmFyZW4=?=
    May 27, 2005
  3. =?Utf-8?B?QmFyZW4=?=

    HTML Generation from XML

    =?Utf-8?B?QmFyZW4=?=, May 27, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    447
    =?Utf-8?B?QmFyZW4=?=
    May 27, 2005
  4. John W. Long

    HTML Generation (Next Generation CGI)

    John W. Long, Nov 22, 2003, in forum: Ruby
    Replies:
    4
    Views:
    317
    John W. Long
    Nov 24, 2003
  5. Erik Wasser
    Replies:
    5
    Views:
    429
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page