What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How to write to xml file?

How to write to xml file?
Author: Message:
y2kbug
New Member
*


Posts: 3
Joined: Jul 2006
O.P. How to write to xml file?
I would like to write some text to an xml file. First, I would like to know how to open a file to write? And then, how to "write" to the file, and at last, how to save it? I know how to use FileSystemObject in Visual Basic 6, but it seems that it doesn't work in the same syntax in this system.

Another question is that, when calling MsgPlus.DisplayToast, how to output a line break? I cannot use HTML tag <br> and also what I use in VB6 - chr(13).

Thanks!!

This post was edited on 07-30-2006 at 04:33 PM by y2kbug.
07-30-2006 04:33 PM
Profile E-Mail PM Find Quote Report
Squelettor
Junior Member
**

Avatar

Posts: 49
Joined: Jul 2006
RE: How to write to xml file?
quote:
Originally posted by y2kbug
Another question is that, when calling MsgPlus.DisplayToast, how to output a line break? I cannot use HTML tag <br> and also what I use in VB6 - chr(13).

Try with '\n'
07-30-2006 09:05 PM
Profile PM Find Quote Report
y2kbug
New Member
*


Posts: 3
Joined: Jul 2006
O.P. RE: How to write to xml file?
quote:
Originally posted by Squelettor
quote:
Originally posted by y2kbug
Another question is that, when calling MsgPlus.DisplayToast, how to output a line break? I cannot use HTML tag <br> and also what I use in VB6 - chr(13).

Try with '\n'


It works!
Thankyou!
07-31-2006 07:00 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: How to write to xml file?
But note that there is currently a 'bug' with it....

When the lines preceding the line break are too long, the line break seems to be ignored and you get stuff like:

"This_is_a_very_long_string_which_I_write_to_show_something\nsecond_line"

displays something like:

This_is_a_very_long_string_which_I_wri
te_to_show_somethingsecond_line


Instead of the expected:

This_is_a_very_long_string_which_I_wri
te_to_show_something
second_line

This post was edited on 07-31-2006 at 08:21 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
07-31-2006 08:20 AM
Profile PM Find Quote Report
rob_botch
Full Member
***

Avatar

Posts: 180
Reputation: 4
33 / Male / Flag
Joined: Apr 2006
RE: How to write to xml file?
To write to xml:

code:
var xml = new ActiveXObject("Microsoft.XMLDOM"); //Create xml object
xml.load(XMLPath); //XMLPath is the path of your XML file

var toAdd = xml.createElement("Element"); //Create an element called "Element"

toAdd.appendChild(xml.createTextNode("Text")); //Add the text "Text" to the element that you just created

xml.getElementsByTagName("Parent")[0].appendChild(toAddMessage); //Add the newly created element to the first instance of "Parent"

xml.save(XMLPath); //Save the XML file to the path specified


I hope that this helps,

Robert
07-31-2006 12:31 PM
Profile E-Mail PM Web Find Quote Report
y2kbug
New Member
*


Posts: 3
Joined: Jul 2006
O.P. RE: How to write to xml file?
quote:
Originally posted by rob_botch
To write to xml:

code:
var xml = new ActiveXObject("Microsoft.XMLDOM"); //Create xml object
xml.load(XMLPath); //XMLPath is the path of your XML file

var toAdd = xml.createElement("Element"); //Create an element called "Element"

toAdd.appendChild(xml.createTextNode("Text")); //Add the text "Text" to the element that you just created

xml.getElementsByTagName("Parent")[0].appendChild(toAddMessage); //Add the newly created element to the first instance of "Parent"

xml.save(XMLPath); //Save the XML file to the path specified


I hope that this helps,

Robert


I wanna say thankyou to you first. I have to find out more about this before I can tell whether it works or not.
07-31-2006 03:58 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On