How to MoveFirst, MoveNext, MovePrevious, MoveLast in LinQ To XMl Please Help

I have the Next XML

			var xml = new XElement( "clients",
			                       new XElement("client",
			                                    new XAttribute("id",1),
			                                    new XElement( "name", "Luis"),
			                                    new XElement( "country",
"Portugal")
			                                   ),
			                       new XElement("client",
			                                    new XAttribute("id",2),
			                                    new XElement( "name", "John"),
			                                    new XElement( "country",
"England")
			                                   ),
			                       new XElement("client",
			                                    new XAttribute("id",3),
			                                    new XElement( "name", "Edwin"),
			                                    new XElement( "country", "Costa
Rica")
			                                   ),
			                       new XElement("client",
			                                      new XAttribute("id",4),
			                                      new XElement( "name",
"Paulo"),
			                                      new XElement( "country",
"Portugal")
			                                     )

			                      );

And I nedd one code to move between nodes but Without use Foreach or
While, Only I Can do next.

			var firstClient = xml.Element("client");
			Debug.WriteLine(firstClient);
			var ancestor = firstClient.NextNode;
			Debug.WriteLine(ancestor);

But with this don`t move more than "id",2 Please Help


Thanks

Edcha
0
edchar (4)
11/3/2008 6:08:07 PM
dotnet.xml 7266 articles. 0 followers. Follow

0 Replies
1054 Views

Similar Articles

[PageSpeed] 22

Reply:

Similar Artilces:

XML #2
I created a database in MS Access 2000 that I collect data and then through queries I export the data to MS Excel 2003. I don't have any problems with that. But is there a way that I can create mappings from MS Excel 2003 to XML? I have learned how to import XML data into MS Excel 2003, but if the data originates in MS Excel 2003 how can I get it out to XML? Can anyone suggest books/websites? Or is there a tool that I can use? Thank you in advance! -- Ryan W Ryan, MS Access 2003 provides this functionality. You can export to XML as an option and create a schema which then can be ...

xml serialization #5
All - I'm pretty comfortable with simple XML serialization of objects. However I observed something the other day and I wanted to know if I solved it the right way. Basically if I have a string which contains a single xml node, I can serialize with this line of code: object = (object)serializer.Deserialize(new XmlTextReader(xml,XmlNodeType.Element,null)); where xml is the string that represents the node However if the string contains two nodes that individually would serialize to the "object" I have to do the following to be able to serialize to an array. Code looks like t...

dynamic search and sort using linq
I need to build a form that will take in string value from dropdowns for: sort_colum_name, search_column_name, table_name and textbox for search_text I know this is possible using expression trees, but somehow cant form the statements. Please help Here's what I have so far: private static List<T> GetSortedData<T>( string sortColumnName) { var type = typeof(T); var property = type.GetProperty(sortColumnName); var parameter = Expression.Parameter(type, "p"); var propertyAccess = ...

Exchange design
Please help with following scenario Set up: Company has a nation-wide Sendmail server that only does POP3 for every branch office in the nation, domain is us.company.com. One branch office decides to deploy SBS/Exchange internally for that office. Problem: internal domain is company.local, recipient policy has us.company.com for mail delivery. Everytime an employee from that office tries to email someone else who is outside of that office that piece of mail gets dropped (because AD user does not exist and because Exchange now handles us.company.com) How would I be able to make it so th...

Help window opens minimized
Until recently, when I clicked on Help in the drop down menu from the Help icon on the toolbar on top of the screen the Help window opened with a screen that filled about half the screen. Now for some reason the Help sceen opens minimized at the top left corner of the screen. What do I need to reset to get it to open to half the screen again? ...

Help with parsing XML document.
Hi, I am going nuts with this. Can you help me write a code to parse this XML document. I need to get values from all the tags and assign them into variables. See code below. The code is in VBScript. Many thanks, Roger. <% option explicit response.expires = 0 Response.CacheControl = "no-cache" response.buffer = true Response.ContentType = "text/html" Dim xmlString xmlString = "<?xml version=""1.0""?>" & _ "<ResponseService Version=""2.3"">" & _ " <Header>" & _ ...

Can someone please tell me why my code stopped working???
Option Explicit The code below worked for a few days and just totally stopped working. What can I do to make sure it continues to work? Thanks! ----- Private Sub Worksheet_Change(ByVal Target As Range) Dim C As Range, D As Range Set D = Intersect(Range("A:A"), Target) If D Is Nothing Then Exit Sub For Each C In D On Error Resume Next Target.Offset(0, 6).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column E Target.Offset(0, 7).FormulaR1C1 = "=RC[-2]&RC[-5]" ' - For Column F Target.Offset(0, 9).FormulaR1C1 = "=IF(ISNA(VLOOKUP...

Sobre el recordset.movefirst
Si el nombre es normal sin comillas me lo coge recordset.movefirst "nombre=' " & strnombre & "'" pero cuando pongo Brian O'Neal se vuelve loco con tres ' Como se resuelve esto para que valga para todos los casos GRACIAS AL GRUPO Y A TOD@S !00000 wrote: > Si el nombre es normal sin comillas me lo coge recordset.movefirst "nombre=' > " & strnombre & "'" > pero cuando pongo Brian O'Neal se vuelve loco con tres ' > > Como se resuelve esto para que valga para todos los casos > > GRACI...

Receipt XML
I would like an extra claim receipt to be printed if a workorder has been issue with the ItemLookupCode "Service". I would print out an extra claim slip with the our company name, Name of customer, barcode number of workorder, Comments and a statement stating that items must be pickup within xx days of being repaired. Jeff if you out there - I' am sure you could do this in your sleep. Danny This is a multi-part message in MIME format. ------=_NextPart_000_010A_01CA5BC8.98F39ED0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-...

Can anyone help with on click code?
I'm trying to display a form that cycles through a list of items and displays checkboxes that are ticked or unticked depending on the item properties. I have written code that uses the _click() event to determine if the status has changed (ie someone has ticked what was previously unticked) and then retrieve via an inputbox some more details which are then inserted into the sheet. HOWEVER, what seems to happen is that Excel is recognising the cycling of items as being _click events and pops up the box for input whenever the checkbox moves from unticked to ticked because the item i...

Repeater and XML Node List
Alrighty, so if I have an XmlNodeList as the data source for a repeater, in my repeater, I would like to do things like: <%# DataBinder.Eval(Container.DataItem, "ChildNodes[0].InnerText") %> But everytime I do it says stuff like: 'System.Xml.XmlChildNodes' does not allow indexed access. Of course, it's perfectly happy to use FirstChild.NextSibling.InnerText, but I'd like to use indexed methods or properties, but it does not seem to work. Here is sample code: <%@ Page Language="C#" autoEventWireup="false"%> <%@ Import Namespa...

XML Custom serialization
Hi all, I want to serialize a class in a customized way. But I don't want to implement the ISerializable interafce because I don't want to take care of every new field I insert to the class. What I need is a way to customize the serialization of a specific field in my class but leave the rest to the build-in serialization. Any guidance will be appreciated. Ro'ee <sfa.roy@gmail.com> wrote in message news:7243a1eb-3fa3-43e0-8339-d90f890e6716@b1g2000hsg.googlegroups.com... > Hi all, > > I want to serialize a class in a customized way. But I don't want to >...

Need help with query summing hours
Tring to get total worked hours and total maintenance hours summary. I have a table with the clock hours WorkID WorkDate WorkEmployeeID WorkHours And have a maintenace table MaintID MaintDate MaintEmployeeID MaintHours Needing help combining the information to get summary something like this.. Date - Employee - Clock Hours - Maintenance Hours 1/1/10 Joe Billy Bob 8 6 1/1/10 Billy Joe Bob 8 7 Whay type of query do I need to build, any help would be great. Thanks -- Message posted via http://www.accessmo...

Optional Nttp Server
Just trying to gage some interest... Some of you may recall a few years ago Msft did away with the MSN news servre(msnnews) and myself and a few others Msn folks migrated over to a private server(AnnexCafe) to keep the group intact. That group eventually evolved in time into a user to user technical support group covering a diverse area for Q and A on all things Windows or related. I've investigated the ability to create a Windows Live Mail nntp newsgroup on that same private Nttp server(username/pw required, and its own TOS)... How many of you might be interested ? -- .......

populate a DataSet via a LINQ query (Linq to XML)
Is there a way to populate a DataSet via a LINQ query? (Linq to XML) Instead of; DataSet ds = new DataSet(); ds.ReadXml(myfile.xml, XmlReadMode.InferTypedSchema); dataGridView1.DataSource = ds.DefaultViewManager; dataGridView1.DataMember = "myNode"; Anthony Anthony wrote: > Is there a way to populate a DataSet via a LINQ query? > > (Linq to XML) > > Instead of; > DataSet ds = new DataSet(); > ds.ReadXml(myfile.xml, XmlReadMode.InferTypedSchema); > dataGridView1.DataSource = ds.DefaultViewManage...

Help with coding a delete button!
Because I have my same list box on 2 seperate forms is there any way I can add these 2 Requery codes to my delete button code that is on my Invoice form which is selected from either frmMain or frmModify..........Thanks for any Help....Bob CurrentProject.Connection.Execute "DELETE * FROM tblAdditionCharge WHERE InvoiceID=" & Nz(val(tbInvoiceID.value), 0) CurrentProject.Connection.Execute "DELETE * FROM tblInvoice WHERE InvoiceID=" & Nz(val(tbInvoiceID.value), 0) Set recInvoice = Nothing End If DoCmd.Close acForm, Me.Nam...

HELP Please!!!!! I am really stuck and need help badly with 2 problems
I have created a modal dialog box has has a toolbar derived object on it. On the toolbar are 2 combo boxes, 1 for changing fonts and 1 for sizes. In the toolbar class, I have the ON_CBN_SELCHANGE handler for both of them. In the handler, I call GetOwner()->SendMessage(WM_NOTIFY, fh.idFrom, (LPARAM)&fh); 2nd param = the tool bar and the 3rd = CHARFORMAT structure I have confirmed that the Owner of the control is the dialog box. the SendMessage returns a 0 In the dialog box I have the following ON_NOTIFY(FN_SETFORMAT, IDR_FORMATBAR, OnSetCharFormat) I set my cursor in the OnSetChar...

Working with XML Files in Dexterity
I have a lot of programming ahead of me (and behind me) working with XML, and I'm working exclusively with Dex (as I have been for 11 years). We need to do some some pretty serious and robust XML file exchanges for various types of transactions. There seems to be two ways to go about this in Dex: 1) going line-by-line looking at nodes with the "dataNode.childNodes.item..." functions, and maneuvering data types for EACH item in a table, For Example: dataNode = rootnodeDispatch.selectSingleNode("VehicleModel"); if not empty(dataNode) then NodeText = dataNode; dat...

Change the XML elements sequence
I export some database data to an XML file. How do I change the sequence of the elements (fields) appear in the XML document? For example, my XML output from TableA is: <TableA> <Field(0)> <Field(1)> <Field(2)> <Field(3)> </TableA> If I want to change the sequence of the fields to: <TableA> <Field(0)> <Field(3)> <Field(1)> <Field(2)> </TableA> Does anyone know what is the easiest way to do this without using "select" statement? (Because this example has been simplified for easier illustrat...

LINQ to XML - Performance
Hi, Can anyone tell me how the performance compares between working with xml documents in the normal way (i.e. with xpath and the System.Xml) and LINQ. Is it any quicker or slower? Are there are distinct benefits to the user (and not just advantages for the coder) to working with LINQ? The work i will be doing is creating an xml document out of segments from other xml documents, transforming the document (XSL) and then retrieving/amending/appending data to the document. Currentlly xml transformations in .net 2.0 are very slow and performance takes a real hit with complex transforms. ...

XML Inheritance
I posted this message yesterday on a different group which may have been the wrong group, so I am not cross posting on purpose. Hi, I have a question regarding how the .Net framework interprets schema definitions based on existing types. I have (for the purposes of demonstration) a very simple types schema which contains some PersonName (T_PERSONNAME) and Address (T_ADDRESS) details as below. <?xml version="1.0" encoding="utf-16" ?> - <xs:schema xmlns=http://com.test.schemas.BaseTypes xmlns:b="http://schemas.microsoft.com/BizTalk/2003" ...

Exch2k3 cluster keeps failing! Need urgent help please...
I am having *major* issues with my exchange cluster today, and I don't know what else to do. I have a 2-node A/P exch2k3 cluster, and all of a sudden the "smtp virtual server instance" would go into an "online-pending" state. Once this happens, everyone loses their connection to the server. After a while, it goes from online-pending, to failed. That problem is bad enough, but another problem is that, it didn't failover to the next node, and I've run diagnostics on the server nodes, and they seem to be fine hardware-wise. These nodes are connected to an ...

Help Please #14
What is the formula that takes hours that have been added up and multiples them by an hourly wage. I know it can be done. I just don't know how. -- darling ------------------------------------------------------------------------ darling's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28855 View this thread: http://www.excelforum.com/showthread.php?threadid=486045 =A8*24*Wage_Rate where A8 holds the hours, it is important to format result as genreal or numbers or currency or else you'll get a large time format -- Regards, Peo Sjoblom "darl...

Generete an XML instance from its XSD
Hi Is there a way to generate in code an empty instance of an XML from it's XSD? I have a lot of schemas and I want at run time to create an empty instance for them (I then have to fill one or two fields). Shahar Shahar Ron wrote: > Is there a way to generate in code an empty instance of an XML from it's XSD? > I have a lot of schemas and I want at run time to create an empty instance > for them (I then have to fill one or two fields). Check out this article <URL:http://msdn2.microsoft.com/en-us/library/aa302296.aspx> which has code to create a sample documen...

Please help with a basic question! (I hope)
Isn't there a formula that can be written that says if a cell is blank put a zero in another cell? For example if cell B3 is blank put a zero in c8? I know this might not sound logical to you power users, but this is a basic spreadsheet made by a newbie. With C8 as your active cell, try this formula: =IF(ISBLANK(B3),0,"" -- Message posted from http://www.ExcelForum.com Hi try =IF(B3="",0,"") -- Regards Frank Kabel Frankfurt, Germany andy3468 wrote: > Isn't there a formula that can be written that says if a cell is > blank put a zero in anoth...