Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2011
    Posts
    23
    Thanks
    4
    Thanked 0 Times in 0 Posts

    In VB.net how do I concatenate the varied value of 3 tags all with the same name?

    How do I concatenate all of the interests from the following XML file into one variable using vb.net 4.

    Code:
    <xml>
         <client>
              <name>Paul Davis</name>
              <interest>Football</interest>
              <interest>Swimming</interest>
              <interest>Internet</interest>
         </client>
    </xml>
    The VB code I have so far is as follows

    Code:
    Dim buffer As String
    
    For Each itm In clients
    If (itm.<name>.Value = CType(Session("Client"), String)) Then
    Continue For
    End If
    
    buffer &= "<table><tr>"
    buffer &= String.Format("<td>{0}</td>", itm.<name>.Value)
    buffer &= String.Format("<td>{0}</td>", // The interests should be selected here
    buffer &= "</tr></table>"
    
    Next
    lblOutput.Text = buffer

  • #2
    New to the CF scene
    Join Date
    Apr 2011
    Posts
    3
    Thanks
    0
    Thanked 2 Times in 2 Posts
    use XPath with an xmlDocument or XDocument if your want to use linq

    To write the Html, i would use an xmlDocument for cleaner code.

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Please do not cross post. Original thread: http://www.codingforums.com/showthread.php?t=225047
    OracleGuy


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •