With an XmlNode from a NodeList Can you tell where you are in the original XmlDocument

This problem was raised in another post

Assuming we have an XmlDocument (xDoc) that has a node (<dickster>)
randomly dispersed throughout the hierarchy.

eg
<root>
	<A>
		<B>
			<C>
				<dickster>1</dickster>
			</C>
		</B>
	</A>
	<D>
		<dickster>2</dickster>
	</D>
	<E>
		<F>
			<dickster>3</dickster>
                        <dickster>4</dickster>
		</F>
	</E>
	<dickster>5</dickster>
</root>


We use SelectNodes to get an XmlNodeList that mathces xpath
"//dickster"

In the problem on the other post we wanted to embed all dickster
elements in say a <temp> element

i.e.
<root>
	<A>
		<B>
			<C>
				<temp>
					<dickster>1</dickster>
				</temp>
			</C>
		</B>
	</A>
	<D>
		<temp>
			<dickster>2</dickster>
		</temp>
	</D>
	<E>
		<F>
			<temp>
				<dickster>3</dickster>
			</temp>
			<temp>
				<dickster>4</dickster>
			</temp>
		</F>
	</E>
	<temp>
		<dickster>5</dickster>
	</temp>
</root>


How can we tell where we are in the xDoc hierarchy when we are looping
through each of the  nodes in the XmlNodeList


i.e.

Dim xDoc As XmlDocument
xdoc.load(<xml>)
Dim xList As XmlNodeList = xDoc.SelectNodes("//dickster")
Dim xnode as XmlNode

For each xnode in xList
     ' how can xnode tell where it belongs in the xml hierarchy ???
Next


I hope this makes sense.

Original issue was raised here:
groups.google.com/group/microsoft.public.dotnet.xml/browse_thread/thread/bab743a6aab8b84d


Dickster

0
gdick (75)
3/24/2006 12:14:57 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
538 Views

Similar Articles

[PageSpeed] 46

Maybe this makes it a bit clearer:

For Each xNode In xList
                Dim xEle As XmlElement = xDoc.CreateElement("temp")
                xEle.AppendChild(xNode)

                ' now I want to replace xNode by xEle but I
                ' dont know how to do that because i dont know where I
                ' am in xDoc in order to use .ReplaceChild()
Next

0
gdick (75)
3/24/2006 12:40:28 PM
Reply:

Similar Artilces:

How many users can Access Support?
From reading the other responses in this website I gather that Access can support anywhere from 20-30 users at once as long as the database is split into a front and back end. Does that number include users who only have their front end copy open but are not using it? The impression I get is that the 20-30 figure applies to users who are actively updating records. I am hoping that as many as 35-45 users could have their front end copy of the database open, without freezing up the database, as long as no more than half of them are trying to work at once. Thanks for your help! Julian...

Can't open incomming mail
I have a few users that are reveicing an error message when trying to open emails. Error message is "This item contains active content that cannot be displayed." Knowledge Base Article said to turn off preview pane. I did that and still cannot open. Please help. ...

Xml-Grid for editing NodeList
Hey XML-Guys, I'm playing now for a couple of days with C# and XML. In earlier threads a mentioned that I develop smaller Web-Applications. Therefore I want to edit and add new nodes to my Xml-Documents. To use a DataSet is not very handy because if the data is to complex it allowed me not to add a row. I'm looking for a XML-Grid that is able to have a XML-File as DataSource and let me filter the Data over a XPath-Expression. After filtering a want edit the resulting NodeList and also add Nodes. The Header of the Grid should show the NodeNames and the DataRows should conta...

What can be in cell but not Print?
What can I put into a cell to identify it but when highlighted with other cells wont print out that cell? -- Thanks in advance for your help....Bob Vance .. .. .. .. If you type a value in a cell and change the font color to white then it does not show on the display and does not print.........if you highlight that cell, with or without others along with it, you can see the white value on the greyed out highlight background........or, maybe a Comment box?......that will put a little red triangle in the upper left corner of the cell, and it does not print out............ hth Vaya con Dios...

Can't drag and drop Server Explorer App Event Log to web form?
I was trying to drag and drop the Application Event Log from Server Explorer to an ASP.NET web form in a Visual Studio 2008, but the drag and drop would not create an Eventlog object as my book said it should do. Does anyone have an idea why Visual Studio isn't creating an Eventlog object for me? On Nov 17, 5:40=A0am, "Mark" <mkh...@gmail.com> wrote: > I was trying to drag and drop the Application Event Log from Server Explo= rer > to an ASP.NET web form in a Visual Studio 2008, but the drag and drop wou= ld > not create an Eventlog object as my ...

How can I put a text box in every cell?
Two questions: -How can I put a text box in every cell that I am using WITHOUT having to insert on manually every time? AND - How can I make sure that a text box inserts itself automatically into a new row whenever I add a row? Thanks! One way is to select the row with the text box and copy it to the next row. Copy and paste it several times and then select the rows and paste them as a group. "bmowell" wrote: > Two questions: > > -How can I put a text box in every cell that I am using WITHOUT having to > insert on manually every time? &g...

Can you import PO's
Does anyone imort Purchase Orders directly from NAV or any other system and if so how are you doing it? Thanks Gaz wrote: > Does anyone imort Purchase Orders directly from NAV or any other system and > if so how are you doing it? > Thanks You can import from NAV through SQL or C/ODBC driver (if you use navision databases).. or using tool how ls retail data director.. cod Gaz, We have a utility to import to a blank PO from CSV file. If you can extract from your other system. May be a solution. http://www.retail-pos.com/addons/csv.html "Gaz" <Gaz@discussions.micr...

can I find merged cells?
I'm trying to sort and get the message "merged cells must be the same size". How can I 'find' the merged cells? David, here is a macro by Dave Peterson that will do it Sub Found_Merged_Cells() 'macro looks for merged cells 'By Dave Peterson Dim myCell As Range Dim resp As Long For Each myCell In ActiveSheet.UsedRange.Cells If myCell.MergeCells Then If myCell.Address = myCell.MergeArea(1).Address Then resp = MsgBox(prompt:="found: " _ & myCell.MergeArea.Addre...

Can all shapes in visio be viewed at once?
I'd like to be able to see all the shapes visio has available at once. Is there any way to do so? Each of the solution sets (building plan, business process, charts, etc.) has their own stencils, each with their own shapes. This tends to be a lot of shapes. It's a matter of scope. As an example the netzoom product has over 55,000 shapes for over 1400 vendors. That's a lot of shapes to display, especially if you also have the ones that might not be included when you install their product.... Are you sure you want all of them? Al "poetdidyaknowit" <poetdidyaknowit...

How can I get more colors in the RECOLOR option?
When I am recoloring a picture in PPT 2007, it only gives me a handful of options as to what colors to choose from. I ran across an internet article that showed an option for More Variations, and it looks like you can choose the exact color you would like, similar to choosing a fill color on an object. How do I do this, when I don't have this option? Here is the internet article: http://www.ellenfinkelstein.com/powerpointtips/powerpoint_tip_recolor_graphics_2007.html Are you saying you don't see "more variations" and "set transparent color" below th...

Can default to 150%
Version: 2004 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel With my new imac everything is looking tiny. <br> Can I get all excel files to default to 150%. thanks! Yes you can. The Macro I sent you for Word will also work in Excel. You need to create an Excel workbook in your Excel Startup folder to contain the Macro so that it runs every time you open an Excel file. Cheers On 7/12/09 5:31 AM, in article 59bae494.-1@webcrossing.JaKIaxP2ac0, "kevs12@officeformac.com" <kevs12@officeformac.com> wrote: > Version: 2004 Operating S...

Can not delete Contracts
I can not delete any contracts which status is Active, Expired or Canceled. I want to do that to clean the sample CRM data intalled by CRM Sample Database Wizard. Thanks ...

Can I hide a project custom field ?
Hi everyone, I created a project custom fields but since it's a formula field I would like to hide it in the Project Information Panel. How can I do this ? A bit like in PWA, the project detail page never shows formula fields. I'm using Project server 2007 Thanks -- Jean-Sébastien Dubois Hi Jean-S�bastien, Sorry, not possible G�rard Ducouret "Jici" <Jici@discussions.microsoft.com> a �crit dans le message de news: 14F7C89E-74C9-42B9-97CB-45DEBB08A620@microsoft.com... > Hi everyone, > > I created a project custom fields b...

Can't send, receiving ok!
I can receive e-mail in Outlook 2000, but I can't send any. All my other accounts (outlook express) are working just fine. Checked with ISP, they say all is well on their side. Any thoughts? ...

Can empty fields be eliminated when printing a mail merge?
When printing a mail merge with, let's say, an address line 1 and an address line2, is it possible to get the printout to only show adress line 1 if there is no data in the address line 2, thereby eliminating a blank line showing up on those addresses that have no address line 2? When you are ready to print, in the print dialogue there is a check-off "Don't print lines that contain only empty fields." -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Rev Chaz" <Rev Chaz@discussions.microsoft.com> wr...

How to tell which record the mouse is over
On a continuous form, is there anyway to find out the record the mouse is over without that record having focus? See: http://www.lebans.com/conformscurcontrol.htm ContinuousFormsCurrentRow.zip is a class that allows you to programmatically access the contents of a bound control, as the user moves their Mouse, but the control does not have the focus. For Forms in Continuous View. Version 1.0 -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "WAstarita" <WilliamAstarita@gmail.com> wrote...

Can't see/accept downloaded transactions for investment accounts
This is a new problem that just started today. It may well be related to having to jump through hoops to get a particular investment bank's direct online services working again. I have Money Deluxe 2008. Basically it seems that *all* of my investment accounts that I've configured to use online services and download position and transaction data directly into Money show "Transactions to read: N" under the "To Review" column in the Banking- >Account List after I do an online update (and no errors are reported), but when I click on the "Transactions to read:...

how can I print an invoice from outlook ?
Is there any way I can set up my 'orders' in outlook so that they can print out as an Invoice or packing slip? I run a small business and don't have an accounting programme at the moment. I have to manually type all the invoices from the orders I receive. I know there must be an easier way - any help gratefully received ! Or anyone recommend a small business programme which I could use? Thanks QuickBooks "Bridget" <Bridget@discussions.microsoft.com> wrote in message news:8997C71D-819D-4B9D-A1DA-F9419603881E@microsoft.com... > Is there any way I can set u...

Customizing canned SSRS reports for GP
Hi, Is it possible to modify the exisiting SSRS reports that are installed with GP through SRSDeployment? Thanks, Michelle Yes, there is. All of the models for the reports are available for download. Look for the Montego reports. Here are the requirements: 1. Any modifications to the source with the intent of reporting against Microsoft Dynamics GP 9.0 will not be supported. 2. The report models contain references to the following account framework. Maximum account length of 60. 10 segments of length 6. Use Fabrikam, Inc. company database with this account framework for consiste...

What is a BTW? Where can BTWs be found?
When using Microsoft Excel 2007: What is a BTW? Where can BTWs be found? I reply in Misc with this, please use one newsgroup Nothing to do with Excel 2007 as far as I know It is VAT on products for example 19% or 6 % in the Netherlands -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "rktheno" <rktheno@discussions.microsoft.com> wrote in message news:150B1D95-947E-4A17-9E78-064E08140F64@microsoft.com... > When using Microsoft Excel 2007: > > What is a BTW? Where can BTWs be found? > > ...

XmlNode
When an XmlNode method returns an XmlNode, such as a child, is this generated on-the-fly or is it the actual component of the internal tree structure? If the parent is moved in the tree, will the pointer remain valid? I have looked at as much of the structure as I can using .NET Reflector and I think it will, but I want to be sure. I 'm planning to add XmlNodes to the Tag property of TreeNodes in a TreeView to be able to persist changes back to the document and I would like to know if this will take up any more memory than when they are not linked in this way, or if it is better to...

How can I preview image attachments in Outlook 2002?
Is there any way to configure Outlook (I am using 2002) to display image attachments in the same way that Outlook Express does? i.e. embedded at the end of the e-mail? If this is not possible, is there a way to View or "Preview" the image attachment without having to "Open" it, or "Save" it and then open it, in my image editing application? No. There is no version of Outlook that can be configured to do inline previewing of attachments. The only time you would see a graphic is if someone sent you an html formatted message and had inserted the picture as a...

Can't save favorite report in Money 2005
Hi - when I customize a report in Money 2005 Premium and try to save it, nothing happens (i.e. when I later pull up "favorite reports", the report I tried to save is not there). Any ideas on how to fix this? Thanks. I'm also having problems savings any favorite reports. Someome please help!! Thanks. "Bill P" wrote: > Hi - when I customize a report in Money 2005 Premium and > try to save it, nothing happens (i.e. when I later pull > up "favorite reports", the report I tried to save is not > there). Any ideas on how to fix this? ...

Can data files for mailmerge be updated?
I have a 4 year old 3.5 disc with addresses that I update each year. Last year I updated using Windows 98, with Office maybe Publisher 2000. Now I am unable to access the info with my Windows XP and Publisher 2003. Is there a way to get to this data, edit it, and make labels in 2005? Thanks Robin from Alaska Copy the list to "My Data" folder in "My Documents." Is it a Publisher list? If it is a .mdb file, Publisher should read it. I think your problem is mainly the floppy disk. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews...

Can't Send/Receive or just plain Send
Outlook '02 SP3 - Win XP - Recently had email problem. Deleted mail accounts then added them again. Server information is correct I now cannot do a send/receive or a send. The buttons "depress" when clicked but no dialog box pops up nor is there a send or receive status in the lower right hand corner. Same thing happens when doing a send except message ends up as a saved draft. I usually know what I did to screw up but this one has me baffled. Please help! APB ...