D
David Lozzi
Howdy,
I have an XML document, see below. I'm trying to read from it and pull
attributes and elements as needed. The only thing i've been able to get to
work is using the Read method of the XmlReader class. I see there are other
methods of moving around but none appear to be working properly. Could you
suggest a better approach following the below flow?
<primarysite Title="Reading Deparment" Description="" Theme=""
ServerRelativeUrl="/">
<users>
<user Name="ROCK\administrator" LoginName="ROCK\administrator" Email="">
<roles />
</user>
<user Name="System Account" LoginName="SHAREPOINT\system" Email="">
<roles />
</user>
</users>
Dim xConfig As New XmlTextReader("c:\wss\Reading_Deparment.xml") '"
& PrimarySiteFile & ".xml")
With xConfig
.MoveToContent()
TimeEntry("Title=" & .GetAttribute("Title") & " Description=" &
..GetAttribute("Description"))
.Read() 'users
.Read() 'user
Do While .Name = "user"
TimeEntry("LoginName=" & .GetAttribute("LoginName") & "
Email=" & .GetAttribute("Email") & " Name=" & .GetAttribute("Name"))
.Read() ' roles
.Read() ' user or role
If .Name = "role" Then
'process the role
End If
.Read() ' user
Loop
.ReadEndElement() ' users
Thanks!
I have an XML document, see below. I'm trying to read from it and pull
attributes and elements as needed. The only thing i've been able to get to
work is using the Read method of the XmlReader class. I see there are other
methods of moving around but none appear to be working properly. Could you
suggest a better approach following the below flow?
<primarysite Title="Reading Deparment" Description="" Theme=""
ServerRelativeUrl="/">
<users>
<user Name="ROCK\administrator" LoginName="ROCK\administrator" Email="">
<roles />
</user>
<user Name="System Account" LoginName="SHAREPOINT\system" Email="">
<roles />
</user>
</users>
Dim xConfig As New XmlTextReader("c:\wss\Reading_Deparment.xml") '"
& PrimarySiteFile & ".xml")
With xConfig
.MoveToContent()
TimeEntry("Title=" & .GetAttribute("Title") & " Description=" &
..GetAttribute("Description"))
.Read() 'users
.Read() 'user
Do While .Name = "user"
TimeEntry("LoginName=" & .GetAttribute("LoginName") & "
Email=" & .GetAttribute("Email") & " Name=" & .GetAttribute("Name"))
.Read() ' roles
.Read() ' user or role
If .Name = "role" Then
'process the role
End If
.Read() ' user
Loop
.ReadEndElement() ' users
Thanks!