Home All Groups Group Topic Archive Search About
Author
7 Apr 2005 6:55 PM
Michael
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

Author
7 Apr 2005 8:01 PM
Chris Murphy via DotNetMonster.com
Are you using serialization to generate the XML?

--
Message posted via http://www.dotnetmonster.com
Author
8 Apr 2005 12:49 PM
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
>