473,387 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Easy way to create an XmlNode with specific xpath?

Is there an easy way to create an XmlNode with a specific XPath, creating
nodes along the way if necessary? For example, if I start with an
XmlDocument xmlDoc with contents:

<Test>
<Node1>Blah</Node1>
</Test>

and I want to store information in the XPath /Test/Node2/SubNode/@attr to
result in:

<Test>
<Node1>Blah</Node1>
<Node2>
<SubNode attr="attrtext" />
</Node2>
</Test>

is there an easy one-liner that will create this node so that I can say the
following??

newNode.InnerText = "attrtext";

Or do I have to code it into a function (I don't need to know how to code
this function - I'm just wondering if there's something I'm missing.)

Thanks!!

-mdb
Jul 21 '05 #1
0 1262

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

Similar topics

9
by: JJ | last post by:
Hi All, I noticed that XmlNode and XpathNavigator are quite similiar. XmlNode seems to navigate over an XML Doc and so does XPathNav so when do I use XPathNavigator instead of XmlNode? ...
4
by: Rune | last post by:
I have two queries that appear to be exactly the same, but one of them returns null while the other one returns a valid result! Can anyone provide an explanation to why this is so? Below is an...
1
by: Jesper | last post by:
Hi, I've read somewhere that try/catch shoudn't be used as an alternative to if clauses (maybe it was in C++ regi). However, when using XmlNode.SelectSingleNode(XPath expression) to get a node,...
0
by: Michael Bray | last post by:
Is there an easy way to create an XmlNode with a specific XPath, creating nodes along the way if necessary? For example, if I start with an XmlDocument xmlDoc with contents: <Test>...
8
by: Vikram Vamshi | last post by:
If I execute XmlNode.SelectNodes("some xpath query") and then use foreach to iterate over it. Will it guaratee that the order of nodes I get will be same as the order of nodes in the original xml...
2
by: Claudio | last post by:
Hi I'm trying to use XPath queries with streaming XML, but I cannot make it working. The solution I'm trying to implement is: create a XmlNode as soon as I have a full XML element and use the...
7
by: martinfrompi | last post by:
I have a container of XmlNodes. Some of them have been removed from the document, some haven't. Is there an easy way to tell which are which? I suppose bool IsPartOfTree(XmlNode node) {...
1
by: jesper_lofgren | last post by:
Hello, i need to help here. I have a xmlnode as you can se below (full xml is in the bottom). I wonder how i can get the values inside the CSammanstallningLista . <CSammanstallning...
5
by: Christof Nordiek | last post by:
When I load a XML-Document from a file, and then get an XmlNode from it, is there any way to get the its original position in the file (line, character)? I want to report it, when there is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.