hi, i want to update a xml element.i used the following code -
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
-
System.Xml.XmlNode xmlUpdateNode;
-
-
xmlDoc.Load("XML//App_Var_Data.xml");
-
xmlUpdateNode = xmlDoc.SelectSingleNode("NAME");
-
xmlUpdateNode.InnerText = "chathura";
-
xmlDoc.Save("XML//App_Var_Data.xml");
-
when i execute i get the following exception
Object reference not set to an instance of an object.
please help pme to solve this problem
chathura bamunusinghe
4 4820 mzmishra 390
Recognized Expert Contributor
The main cause for this type of error is
1. nOt declaring variable
2. Bad scope of the variable
3.Bad inits/constructs
Just check you ahve done all these correctly and also let us know which line is throwing the exception
Hi,
Could you please provide which line throws that exception?
I would assume that the following line throws the exception
xmlUpdateNode.I nnerText = "chathura";
are you sure that the element NAME exists in the xml document (case sensitive)
If it does is it the root element?
if not, what you need to search online is navigating through an xml document (xpath is your friend here)
Hi,
Could you please provide which line throws that exception?
I would assume that the following line throws the exception
xmlUpdateNode.I nnerText = "chathura";
are you sure that the element NAME exists in the xml document (case sensitive)
If it does is it the root element?
if not, what you need to search online is navigating through an xml document (xpath is your friend here)
Yes
xmlUpdateNode.I nnerText = "chathura";
throws the exception.
i checked. element NAME exists(in upper case)
so please explain about xpath im new to c#
thanks
chathura bamunusinghe
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: christopher.c.brewster |
last post by:
A few years ago my department defined a DTD for a projected class of
documents. Like the US Constitution, this DTD has details that are
never actually used, so I want to clean it up. Is there any tool that
looks at existing documents and compares with the DTD they use?
Christopher Brewster
|
by: Darrel |
last post by:
I'm creating a table that contains multiple records pulled out of the
database. I'm building the table myself and passing it to the page since the
table needs to be fairly customized (ie, a datagrid isn't going to work).
On this page, people can update a variet of records. On submit, I want to
then go in and update all of the records.
Normally, I'd make each form element include a runat: server and then
declare it in my codebhind so I...
|
by: Asaf |
last post by:
Hi,
I have a MSSQL 2005 test DB with two tables:
Table "T1Customers":
T1CustomersRowEnum (PK, int, Not Null)
T1CustomersFullName (nvarchar(50) null)
Table "T2Details":
|
by: mfreeman |
last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown
below. All I do is loop through the records in the table and update
them without making any changes. Out of 600 records, about 40 of them
throw Concurrency violation errors in the update, and my GetAllColErrs
function provides no output. In comparing the rows that throw errors
with those that do not, I could find no pattern.
It is obviously a bogus error, as the...
|
by: Rob Long |
last post by:
Hi
I have an HTML select element in my page and it's multiple property is
disabled (one item at a time mode) but I still want to transfer all the
items in the select to the server when the form is submitted.
I'm using javascript to change the multiple property of the select
element to true and then I'm looping through each option to change its
selected property to true.
| |
by: explode |
last post by:
My table has 5 columns: Broj iksice, Prezime, Ime, Broj indeksa, Broj
pohadjanja.
This is the code in the dataset designer VB made it by it self:
Private Sub InitClass()
Me.columnBroj_iksice = New System.Data.DataColumn("Broj iksice",
GetType(Double), Nothing, System.Data.MappingType.Element)
Me.columnBroj_iksice.ExtendedProperties.Add("Generator_ColumnPropNameInRow",
"Broj_iksice")...
|
by: chimambo |
last post by:
Hi All,
I have a little problem. I am retrieving records from a table and I
want to update the records using checkboxes. I am able to display the
database record quite alright and I have created an array of
checkboxes, but my update loop is not working. Here is my code:
/*---------This retrieves the records -------------*/
if($row_md)
{
do{
echo "<tr><td text align='right'>";
|
by: mevryck |
last post by:
Greetings
I have a huge Javascript with inclusion of external scripts and all. I
got this by doing a XSLT .
Now I have the contents in a Javascript variable, but I'm not able to
update the element with the javascript contents.
But when viewed as a seperate HTML file with the below contents I'm
able to see the milonic menu http://www.milonic.com .
<div>
|
by: Evan |
last post by:
Hello -
My script use a DB file which is written by XML, and the user load
this DB file (XML tree in memory), and then do some updating about
this tree, such as delete element, generate new element or move
element.
The thing is, my script is a cmd based program (based on module
"cmd"), and there are many users would use this script at same time,
in a shell style prompt (module "cmd"), so I want to implement a
|
by: Andy |
last post by:
I want to dynamically update a list of elements shown as a checkbox
list. A file is used to store the elements, and elements can be added
and deleted from the list. The trouble is that the window is not
properly updated after deleting/adding items.
I use the Detach()/Destroy() to remove the sizer, and then I create a
new and updated sizer again. Apparently, not in a correct way...
#################File...
|
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...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |