473,804 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

system error when writing 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.WriteConfigI nfo("User Modes", chkInvisible.Te xt,
chkInvisible.Ch ecked, "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.DocumentEl ement).SelectSi ngleNode("/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.DocumentEl ement).SelectSi ngleNode("confi guration")
' remove the section
node2.RemoveChi ld(node1)
ElseIf aValue = "" Then
' find the section of this key
node1 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection)
' return if the section doesn't exist
If node1 Is Nothing Then Return True
' find the key
node2 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection &
"/" & aKey)
' return true if the key doesn't exist
If node2 Is Nothing Then Return True
' remove the key
If node1.RemoveChi ld(node2) Is Nothing Then Return False
Else
' Both the Key and the Value are filled
' Find the key
node1 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection &
"/" & aKey) <======= error occured in here.
If node1 Is Nothing Then
' The key doesn't exist: find the section
node2 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection)
If node2 Is Nothing Then
' Create the section first
Dim e As Xml.XmlElement =
Doc.CreateEleme nt(aSection)
' Add the new node at the end of the
children of ("configuration ")
node2 = Doc.DocumentEle ment.AppendChil d(e)
' return false if failure
If node2 Is Nothing Then Return False
' now create key and value
e = Doc.CreateEleme nt(aKey)
e.InnerText = aValue
' Return False if failure
If (node2.AppendCh ild(e)) Is Nothing Then
Return False
Else
' Create the key and put the value
Dim e As Xml.XmlElement =
Doc.CreateEleme nt(aKey)
e.InnerText = aValue
node2.AppendChi ld(e)
End If
Else
' Key exists: set its Value
node1.InnerText = aValue
End If
End If
' Save the document
Doc.Save(FileNa me)
End Function

regards,

Jul 21 '05 #1
1 1701
<configuratio n>
-
<PirateChat>
<RealName>Pirat eChat XP Prof 2004 version 1.0 </RealName>
<Email>su***@to yota.com</Email>
<Nick>doremaf a</Nick>
<AltNick>djanjo </AltNick>
<Pswrd>supra</Pswrd>
<Network>Undern et</Network>
<Server>eu.unde rnet.org</Server>
</PirateChat>
</configuration>

Supra wrote:
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.WriteConfigI nfo("User Modes", chkInvisible.Te xt,
chkInvisible.Ch ecked, "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.DocumentEl ement).SelectSi ngleNode("/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.DocumentEl ement).SelectSi ngleNode("confi guration")
' remove the section
node2.RemoveChi ld(node1)
ElseIf aValue = "" Then
' find the section of this key
node1 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection)
' return if the section doesn't exist
If node1 Is Nothing Then Return True
' find the key
node2 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection &
"/" & aKey)
' return true if the key doesn't exist
If node2 Is Nothing Then Return True
' remove the key
If node1.RemoveChi ld(node2) Is Nothing Then Return
False
Else
' Both the Key and the Value are filled
' Find the key
node1 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection &
"/" & aKey) <======= error occured in here.
If node1 Is Nothing Then
' The key doesn't exist: find the section
node2 =
(Doc.DocumentEl ement).SelectSi ngleNode("/configuration/" & aSection)
If node2 Is Nothing Then
' Create the section first
Dim e As Xml.XmlElement =
Doc.CreateEleme nt(aSection)
' Add the new node at the end of the
children of ("configuration ")
node2 = Doc.DocumentEle ment.AppendChil d(e)
' return false if failure
If node2 Is Nothing Then Return False
' now create key and value
e = Doc.CreateEleme nt(aKey)
e.InnerText = aValue
' Return False if failure
If (node2.AppendCh ild(e)) Is Nothing Then
Return False
Else
' Create the key and put the value
Dim e As Xml.XmlElement =
Doc.CreateEleme nt(aKey)
e.InnerText = aValue
node2.AppendChi ld(e)
End If
Else
' Key exists: set its Value
node1.InnerText = aValue
End If
End If
' Save the document
Doc.Save(FileNa me)
End Function

regards,

Jul 21 '05 #2

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

Similar topics

9
4967
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 webserver runs that part of the script (see attached file, snippet.php), though, it doesn't go through. I don't get an error message or anything...it just returns a "1" (whereas it should return a "0") as far as I can tell. I have read the PHP...
5
5471
by: Burton Roberts | last post by:
This is also posted in the security newsgroup. Sorry for cross-posting, but I'm desperate. I have a Winforms application in VB.NET with a SQL Server (MSDE) backend. In the root application directory I have an XML file, LicXML.XML which holds licensing info for the app. On one group of machines where the users have restricted privileges, the deserialization of this file trips an error as follows (excuse mispellings from my client):
8
5332
by: José Achig | last post by:
Hi I have to use functions inside of system apis so I want the correct dllimports declarations in c# for the following functions or information about where I can get these statements. + OpenProcess + CloseHandle + EnumProcesses +EnumProcessModules
5
2076
by: Paul Bergson | last post by:
I have been trying to get a process to start up and run with arguments passed to it. I have gotten close (Thanks to help from this board) but I there is a failure while I'm running this because the c:\bin\xcacls starts nothing happens. How can I see output from the console i was trying to get the ProcessStartInfo.RedirectStandardOutput Property to work but even if I got the system to process it I didn;t know where the output was being...
4
1496
by: 101 | last post by:
I get a security error when trying to write out to an XMLSchema file "myDs.WriteXmlSchema(strXMLSchemaFile)". I am running XP SP2, No Domain, MS file and print sharing uninstalled. I was able to get past this by making ASPNET part of the Administrators group. I tried the Power User group (as well as others) to no avail. I also had to install MS file and print sharing in order to even add ASPNET as a member of the Administrator group (or...
11
3758
by: Nurit N | last post by:
This is the third newsgroup that I'm posting my problem. I'm sorry for the multiple posts but the matter becoming urgent. I hope this is the right place for it... I have created a very simple batch file (echo hello world) and was trying to retrieve the standard output but every time I run the code it returns ExitCode as 1.
14
2823
by: prasadjoshi124 | last post by:
Hi All, I am writing a small tool which is supposed to fill the filesystem to a specified percent. For, that I need to read how much the file system is full in percent, like the output given by df -k lopgod10:~/mycrfile # df -k /mnt/mvdg1/vset Filesystem 1K-blocks Used Available Use% Mounted on
0
6102
by: jammendolia | last post by:
Hello all, I am having an intermittent exception occur when writing the the eventlog from a windows service application written in c#, running on a Win2k SP4 server. Here's the code: void writeToEventLog(string msg, bool error) {
2
2784
by: Nelly78 | last post by:
Hi All, I have a situtation my application is running on windows 2003 server which is a domain and in web.config <Identity impersonation=true username=ABC\XYZ password=******> what i am doing in the code that i take folder path from user and retrive all file information from that folder and writing to a CSV file which i am creating using StreamWriter.
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10604
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.