saving xml in javascript

Discussion in 'XML' started by charlesmusco@gmail.com, Oct 27, 2006.

  1. Guest

    Hi all. I have the following problem. I have an xml file, while I will
    list below and I am trying to add nodes to the xml document based on
    user input to a form.

    The XML doc is ...

    <?xml version="1.0"?>

    <board>
    <message>
    <author> Author One </author>
    <comment> This is the first test comment </comment>
    </message>
    <message>
    <author> Author Two </author>
    <comment> This is the second test comment </comment>
    </message>
    <message>
    <author> Author Three </author>
    <comment> This is the third test comment </comment>
    </message>
    </board>


    The code I have to insert a new node is ....

    <script type="text/javascript">
    var xmlDoc;
    var xmlObj;
    var author;
    var comment;
    var message;
    function loadXMLDoc() {

    xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async="false";
    xmlDoc.load("Guestbook.xml");
    xmlObj=xmlDoc.documentElement;
    processInput();
    }

    function processInput() {
    var new_message=xmlDoc.createElement('message');
    var new_author=xmlDoc.createElement('author');
    var new_comment=xmlDoc.createElement('comment');
    var new_author_text=new_author.createTextNode('author test
    works');
    var new_comment_text=new_comment.createTextNode('comment test
    works');
    new_message.appendChild(new_author);
    new_message.appendChild(new_comment);
    xmlObj.appendChild(new_message);
    xmlDoc.save("Guestbook.xml");
    }

    </script>


    Currently when I execute this is makes no change whatsoever to the xml
    file. What I expected was to open the xml doc manually and see 4 child
    nodes of the root instead of 3 as shown above in the xml listing. Any
    thoughts or ideas on what I'm doing wrong?

    Also of note is the above code is in the head section of a JSP file.
    Just using JSP instead of HTML file but no jsp code is actually in the
    file, just html.

    Thanks,
    Charles
    , Oct 27, 2006
    #1
    1. Advertising

  2. wrote:


    > I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.


    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");



    > xmlDoc.save("Guestbook.xml");


    Whether calling the save method successfully is allowed depends on the
    host your script is used in. IE with normal security settings does not
    allow that, I am not even sure lowering security settings will allow it.
    It is however allowed to call save in a Windows Script Host script, in
    an ASP page, in a HTML application (HTA), to name the most common hosts.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Oct 27, 2006
    #2
    1. Advertising


  3. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Desidero appena dire che e un luogo ben cotto http://www.usate348.org/progetti

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Desidero appena dire che e un luogo ben cotto http, Feb 21, 2007
    #3

  4. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    mmm.. nice design, I must say.. http://www.bovso.org/amici

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    mmm.. nice design, I must say.. http://www.bovso.o, Feb 23, 2007
    #4

  5. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Guter Aufstellungsort, ja! http://www.flryanair.org/mondo

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Guter Aufstellungsort, ja! http://www.flryanair.or, Feb 25, 2007
    #5

  6. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Luogo grande! Grande giusto! I miei riguardi migliori al proprietario:) http://www.canaxe.org/antivirus

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Luogo grande! Grande giusto! I miei riguardi migli, Feb 28, 2007
    #6

  7. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Luogo molto buon:) Buona fortuna! http://www.canaxe.org/racconti

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Luogo molto buon:) Buona fortuna! http://www.canax, Feb 28, 2007
    #7

  8. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Very valuable information you have here. Thanks.. http://www.canaxe.org/entertainment

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Very valuable information you have here. Thanks.. , Feb 28, 2007
    #8

  9. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Desidero appena dire che e un luogo ben cotto http://www.canaxe.org/trasporti

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Desidero appena dire che e un luogo ben cotto http, Mar 1, 2007
    #9

  10. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Stupore! ho una sensibilit molto buona circa il vostro luogo!!!! http://www.canaxe.org/veneto

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Stupore! ho una sensibilit molto buona circa il vo, Mar 1, 2007
    #10

  11. > > Currently when I execute this is makes no change whatsoever to the xml
    > > file. What I expected was to open the xml doc manually and see 4 child
    > > nodes of the root instead of 3 as shown above in the xml listing. Any
    > > thoughts or ideas on what I'm doing wrong?


    It is not possible, by JavaScript policy, to save a document in the
    client side.

    You might ask for that using a server side script writen in php for
    example...
    --
    Une Bévue
    =?ISO-8859-1?Q?Une_B=E9vue?=, Mar 1, 2007
    #11

  12. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    I'll be BACK! :) ;) http://www.canaxe.org/videocamere

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    I'll be BACK! :) ;) http://www.canaxe.org/videocam, Mar 1, 2007
    #12

  13. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    E evidente che il luogo e stato fatto dalla persona che realmente conosce il mestiere! http://www.canaxe.org/vetro

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    E evidente che il luogo e stato fatto dalla person, Mar 1, 2007
    #13

  14. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Very valuable information you have here. Thanks.. http://www.canaxe.org/traduzioni

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Very valuable information you have here. Thanks.. , Mar 1, 2007
    #14

  15. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Luogo molto buon:) Buona fortuna! http://www.canaxe.org/sexi

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Luogo molto buon:) Buona fortuna! http://www.canax, Mar 1, 2007
    #15

  16. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Grande sito!! http://www.avwzioni.org/capelli

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Grande sito!! http://www.avwzioni.org/capelli, Mar 1, 2007
    #16

  17. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Great site! Good luck to it's owner! http://www.avwzioni.org/nudi

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Great site! Good luck to it's owner! http://www.av, Mar 2, 2007
    #17

  18. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    luogo grande:) nessun osservazioni! http://www.avwzioni.org/molise

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    luogo grande:) nessun osservazioni! http://www.avw, Mar 2, 2007
    #18

  19. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Grand emplacement! La conception est merveilleuse! http://www.avwzioni.org/supereva

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Grand emplacement! La conception est merveilleuse!, Mar 2, 2007
    #19

  20. > Hi all. I have the following problem. I have an xml file, while I will
    > list below and I am trying to add nodes to the xml document based on
    > user input to a form.
    >
    > The XML doc is ...
    >
    > <?xml version="1.0"?>
    >
    > <board>
    > <message>
    > <author> Author One </author>
    > <comment> This is the first test comment </comment>
    > </message>
    > <message>
    > <author> Author Two </author>
    > <comment> This is the second test comment </comment>
    > </message>
    > <message>
    > <author> Author Three </author>
    > <comment> This is the third test comment </comment>
    > </message>
    > </board>
    >
    >
    > The code I have to insert a new node is ....
    >
    > <script type="text/javascript">
    > var xmlDoc;
    > var xmlObj;
    > var author;
    > var comment;
    > var message;
    > function loadXMLDoc() {
    >
    > xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async="false";
    > xmlDoc.load("Guestbook.xml");
    > xmlObj=xmlDoc.documentElement;
    > processInput();
    > }
    >
    > function processInput() {
    > var new_message=xmlDoc.createElement('message');
    > var new_author=xmlDoc.createElement('author');
    > var new_comment=xmlDoc.createElement('comment');
    > var new_author_text=new_author.createTextNode('author test
    > works');
    > var new_comment_text=new_comment.createTextNode('comment test
    > works');
    > new_message.appendChild(new_author);
    > new_message.appendChild(new_comment);
    > xmlObj.appendChild(new_message);
    > xmlDoc.save("Guestbook.xml");
    > }
    >
    > </script>
    >
    >
    > Currently when I execute this is makes no change whatsoever to the xml
    > file. What I expected was to open the xml doc manually and see 4 child
    > nodes of the root instead of 3 as shown above in the xml listing. Any
    > thoughts or ideas on what I'm doing wrong?
    >
    > Also of note is the above code is in the head section of a JSP file.
    > Just using JSP instead of HTML file but no jsp code is actually in the
    > file, just html.
    >
    > Thanks,
    > Charles


    Grande! Il luogo cose buon, tutto e abbastanza ragionevole e piacevole.. http://www.avwzioni.org/economici

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities
    Grande! Il luogo cose buon, tutto e abbastanza rag, Mar 2, 2007
    #20
    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. John Kandell
    Replies:
    4
    Views:
    4,143
    eeebop
    Dec 10, 2004
  2. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,495
    Luis Esteban Valencia
    Jan 6, 2005
  3. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    196
    Curt_C [MVP]
    Oct 3, 2003
  4. Erik Wasser
    Replies:
    5
    Views:
    436
    Peter J. Holzer
    Mar 5, 2006
  5. noff
    Replies:
    0
    Views:
    199
Loading...

Share This Page