473,503 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting Nodes using doc.selectnode()

42 New Member
hi all,
i have an xml document. it contains several nodes...
here i want to select a particular node containing the name say "$abc"
so i'm using this

docXML3.SelectNodes("$abc=*abc *123");

but here an exception is raised telling that the expression ("$abc=*abc *123" )not supported.
what should i do to avoid this situation?

thanks in advance.
Oct 29 '08 #1
3 2241
markmcgookin
648 Recognized Expert Contributor
hi all,
i have an xml document. it contains several nodes...
here i want to select a particular node containing the name say "$abc"
so i'm using this

docXML3.SelectNodes("$abc=*abc *123");

but here an exception is raised telling that the expression ("$abc=*abc *123" )not supported.
what should i do to avoid this situation?

thanks in advance.
Is this in .Net? Please post a bit more about your environment.
Oct 29 '08 #2
libish
42 New Member
Is this in .Net? Please post a bit more about your environment.
yes it is in c#.Net.

here what i'm doing is.. i got an xml file containing parameters for my application
the parameter names are represented by "$parametername"
here in my xml file the parameter will be like

<var>
<v>"$para=12343"</v>
<v>"$para2=*hagr"</v>
</var>

at some point in my project i wll be in need to change the parameter value for
"$para"

this is how this situation arised...
here i need to modify the node with new values...
for that what should i do?
Oct 30 '08 #3
markmcgookin
648 Recognized Expert Contributor
yes it is in c#.Net.

here what i'm doing is.. i got an xml file containing parameters for my application
the parameter names are represented by "$parametername"
here in my xml file the parameter will be like

<var>
<v>"$para=12343"</v>
<v>"$para2=*hagr"</v>
</var>

at some point in my project i wll be in need to change the parameter value for
"$para"

this is how this situation arised...
here i need to modify the node with new values...
for that what should i do?
Try something like this

Expand|Select|Wrap|Line Numbers
  1.  
  2. XmlDocument.xmlDetails = new XmlDocument();
  3. xmlDetails.Load(@"MyDir\Templates\Setup.xml");
  4. XmlNodeList nodeList = xmlDetails.GetElementsByTagName("Settings");
  5.  
  6.                 foreach (XmlElement elem in nodeList)
  7.                 {
  8.                     foreach (XmlElement tempElem in elem.ChildNodes)
  9.                     {
  10.                         if (tempElem.Name == "Setup")
  11.                         {
  12.                             myString Variable = tempElem.InnerText;
  13.                         }
  14.                         if (tempElem.Name == "Value")
  15.                         {
  16.                             tempElem.InnerText = "A string value";
  17.                         }
  18.                      }
  19.                   }
  20.  
  21. xmlDetails.save(@"MyDir\Templates\Setup.xml");
  22.  
Oct 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2070
by: Richard Trahan | last post by:
I have a form larger than a screen. When some radio buttons or checkboxes are clicked, I need to change the contents of a select (menu) box by rebuilding the select node. That method is necessary...
2
1552
by: Dag | last post by:
Hi I am pretty much an xml beginner; hopefully someone can easily answer this one... I want to select a node representing a worksheet in an xml document for the Office Web Components spreadsheet....
1
9276
by: Cheryl | last post by:
I have problems selecting the attribute when I use the SelectNode function. <book> <title store='7456' >Nutshell</title> <author id='1'>Drayton</author> <xauthor publish = "1" publishtime =...
2
1464
by: Saurabh Sharma | last post by:
Hi, I am using Dom Parsing in Xml. I am the parent node and it has many children and each children has many children. I want to select children with a given name . Is there any method by which we...
2
7479
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
4
3664
by: visu | last post by:
I need a solution to my problem. the problem is I ll have a button in page ... and when i click it .. content of a div tag has to be get selected (i.e what we normally do with mouse to...
11
6083
by: J_Zanetti | last post by:
Hello everybody, In my applications I've a ton of scripts that use remote XML file to fill forms and evaluate contents; In these scripts I always use the method SelectNode (that, with some...
2
4045
by: dav61000 | last post by:
I am new to VB.net so I am not sure if there is a good way to do this or not but here is my problem. I have created a form with a TreeView control on it. When the user selects a node from the...
1
2727
by: karthee | last post by:
I am creating a custom treeview with multiple selection, if i select multiple nodes and right click, the selection is disappearing, i tried with somany things like on mouse click my code is...
0
7202
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,...
0
7086
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
7280
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
7332
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...
1
6991
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...
1
5014
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
1512
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
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
382
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...

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.