|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
XMLReader and VB.NetI need a few suggestions. I have the following XML segment: <LookUp> <ControlType>CheckBoxGroup</ControlType> <DBField>LastMedDate</DBField> <ControlName>cmbGoal1</ControlName> <Values VALUE="0" BookMark="Goal1Progress"/> <Values VALUE="1" BookMark="Goal1NoProgress"/> <Values VALUE="2" BookMark="Goal1NA"/> </LookUp> I have code that will read everything except the "Values" elements. Here is the code: While reader.Read() Select Case (reader.NodeType) Case XmlNodeType.Element If (reader.Name = "DBField") Then ReportElement.DBField() = reader.ReadElementString() End If If (reader.Name = "BookMark") Then ReportElement.BookMark = reader.ReadElementString() End If If (reader.Name = "ControlName") Then ReportElement.ControlName = reader.ReadElementString() End If If (reader.Name = "ColumnIndex") Then ReportElement.ColumnIndex = reader.ReadElementString() End If If (reader.Name = "ControlType") Then ReportElement.ControlType = reader.ReadElementString() End If If (reader.Name = "Values") Then ReportElement.AddValue (0, reader.ReadElementString()) End If case XmlNodeType.EndElement If (reader.Name = "LookUp") then al.Add(ReportElement) ReportElement.Reset() End If End Select End While I've tried a few different things to get the Values elements such as: reader.GetAttribute("BookMark") But it returns "Nothing" in the Command window. Could someone please let me know how to get the values element. Thanks Michael Hi Chris,
THanks for the reply. I just bought a book Yesterday and found my answer there. I needed to use the MoveToNextAttribute of the reader object. Once I did that, I was able to get into the attributes. Thanks for the reply. Michael Lee Show quoteHide quote "Chris Murphy via DotNetMonster.com" wrote: > Are you using serialization to generate the XML? > > -- > Message posted via http://www.dotnetmonster.com >
Reading Output from Shell Command
Help with some code? for loop ending condition Writing TIF to database open binary file and search hex string Problems with the excel find function in vb.net Dataview Find method, case insensitive? How to use Regex to Parse this String Remote debugging: Unable to map the debug start page URL to a machine name Moving a windows form from a windows app to a class library. |
|||||||||||||||||||||||