Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > XML generation

Reply
Thread Tools

XML generation

 
 
Peter Laman
Guest
Posts: n/a
 
      05-05-2008
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?
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      05-05-2008
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/
 
Reply With Quote
 
 
 
 
Joseph J. Kesselman
Guest
Posts: n/a
 
      05-05-2008
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?
 
Reply With Quote
 
Joseph J. Kesselman
Guest
Posts: n/a
 
      05-05-2008
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.
 
Reply With Quote
 
Peter Laman
Guest
Posts: n/a
 
      05-06-2008
On May 5, 9:38 pm, "Joseph J. Kesselman" <(E-Mail Removed)>
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.
 
Reply With Quote
 
Peter Laman
Guest
Posts: n/a
 
      05-06-2008
On May 5, 5:20 pm, Martin Honnen <(E-Mail Removed)> 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!
 
Reply With Quote
 
Joseph J. Kesselman
Guest
Posts: n/a
 
      05-06-2008
Ah. OK, that's reasonable.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
HTML Generation from XML =?Utf-8?B?QmFyZW4=?= ASP .Net 0 05-27-2005 02:30 PM
HTML Generation from XML =?Utf-8?B?QmFyZW4=?= ASP .Net 0 05-27-2005 02:27 PM
XSL Transformation - Dynamic Generation of XML Content Hugo Ferreira ASP .Net 0 07-14-2004 11:25 AM
HTML Generation (Next Generation CGI) John W. Long Ruby 4 11-24-2003 04:24 AM



Advertisments