473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

system error when writitng to xml....

i got "system error" when saving to xml file.
i am using checkbox1 control to xml. when user clicked checkbox and set
to true and press btnOk to conform and save it to xml

rw.WriteConfigInfo("User Modes", chkInvisible.Text,
chkInvisible.Checked, "PirateChat.xml")

the error occured in hightleighted in below :.......

Public Function WriteConfigInfo(ByVal aSection As String, ByVal aKey As
String, ByVal aValue As String) As Boolean
Dim node1 As XmlNode
Dim node2 As XmlNode
If aKey = "" Then
' find the section, remove all its keys and remove
the section
node1 =
(Doc.DocumentElement).SelectSingleNode("/configuration/" & aSection)
' if no such section, return True
If node1 Is Nothing Then Return True
' remove all its children
node1.RemoveAll()
' select its parent ("configuration")
node2 =
(Doc.DocumentElement).SelectSingleNode("configurat ion")
' remove the section
node2.RemoveChild(node1)
ElseIf aValue = "" Then
' find the section of this key
node1 =
(Doc.DocumentElement).SelectSingleNode("/configuration/" & aSection)
' return if the section doesn't exist
If node1 Is Nothing Then Return True
' find the key
node2 =
(Doc.DocumentElement).SelectSingleNode("/configuration/" & aSection &
"/" & aKey)
' return true if the key doesn't exist
If node2 Is Nothing Then Return True
' remove the key
If node1.RemoveChild(node2) Is Nothing Then Return False
Else
' Both the Key and the Value are filled
' Find the key
node1 =
(Doc.DocumentElement).SelectSingleNode("/configuration/" & aSection &
"/" & aKey) <======= error occured in here.
If node1 Is Nothing Then
' The key doesn't exist: find the section
node2 =
(Doc.DocumentElement).SelectSingleNode("/configuration/" & aSection)
If node2 Is Nothing Then
' Create the section first
Dim e As Xml.XmlElement =
Doc.CreateElement(aSection)
' Add the new node at the end of the
children of ("configuration")
node2 = Doc.DocumentElement.AppendChild(e)
' return false if failure
If node2 Is Nothing Then Return False
' now create key and value
e = Doc.CreateElement(aKey)
e.InnerText = aValue
' Return False if failure
If (node2.AppendChild(e)) Is Nothing Then
Return False
Else
' Create the key and put the value
Dim e As Xml.XmlElement =
Doc.CreateElement(aKey)
e.InnerText = aValue
node2.AppendChild(e)
End If
Else
' Key exists: set its Value
node1.InnerText = aValue
End If
End If
' Save the document
Doc.Save(FileName)
End Function


my output look like this:
<configuration>
-
<PirateChat>
<RealName>PirateChat XP Prof 2004 version 1.0 </RealName>
<Email>su***@toyota.com</Email>
<Nick>doremafa</Nick>
<AltNick>djanjo</AltNick>
<Pswrd>supra</Pswrd>
<Network>Undernet</Network>
<Server>eu.undernet.org</Server>
</PirateChat>
</configuration>

regards,

Nov 12 '05 #1
0 1295

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
1
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid...
4
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am...
5
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve...
3
by: Sarah | last post by:
I have a function residing in a module that is doing some file copy and database query operations. This function is called from a regular form under a System.Windows.Forms.Timer control. The...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
0
by: Jim Duffie | last post by:
Hi, I am trying to build a simple websire using the above in Visual Web Developer. When finished I have build the website and it works fine locally but when I FTP it to the server I am getting a...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.