Re: Getting attributes(I think) from XMLReader
- From: "Alex Passos" <bz@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 7 Apr 2005 14:04:19 -0500
I think those nodes would be of type attribute. Put in a case statement to
handle this type in your code.
"Michael" <Michael@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:8C9F3701-3DE1-4856-A778-5AF88513AB30@xxxxxxxxxxxxxxxx
> Hi All,
> I 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
>
.
- Follow-Ups:
- Re: Getting attributes(I think) from XMLReader
- From: Michael
- Re: Getting attributes(I think) from XMLReader
- References:
- Getting attributes(I think) from XMLReader
- From: Michael
- Getting attributes(I think) from XMLReader
- Prev by Date: Getting attributes(I think) from XMLReader
- Next by Date: Re: How to loop thru XML Schema and retrieve s the element name
- Previous by thread: Getting attributes(I think) from XMLReader
- Next by thread: Re: Getting attributes(I think) from XMLReader
- Index(es):
Relevant Pages
|