Results 1 to 32 of 32

Thread: VB.NET: Get the Attribute and Text out from Xml....[Resolved]

Threaded View

  1. #27

    Thread Starter
    Addicted Member toytoy's Avatar
    Join Date
    Jul 2004
    Posts
    230

    Re: VB.NET: Get the Attribute and Text out from Xml....[Unresolved]

    From the previous Xml tags:
    Code:
    <Books>
          <Title section ="1">
              <Reference web = "www.any.com" topic = "1">
          </Title>
          <Title section ="5">
              <Reference web = "www.idea.com" topic = "2">
          </Title>
          <Title section ="5">
              <Reference web = "www.howTo.com" topic = "3">
          </Title>
          <Title section ="9">
              <Reference web = "www.do.com" topic = "4">
          </Title>
    </Books>
    Say i have 3 section name for the Title:
    "1" stand for Science, "2" stand for Gerenal and "3" stand for History

    when i receive the section attribute from the server, i have to do some comparing with the number...like 2 to the power of 1 indicate the event of Science, 2 to the power of 2 indicate Gerenal and so on.

    Thus when i receive the number "5" for section in this case, it indicate the events of Science and Gerenal...
    so all those fields with attribute "5" will be extract.......

    The exponent method is:
    Code:
     Public Function pow(ByVal exponent As Integer, ByVal base As Integer)
    
            result = base ^ exponent
            subtotal = result
            total = total + subtotal
            Return total
    
        End Function
    with the above method, what should i do to compare the number with the section attributes correctly and display it to a listbox...

    Currently, i may extract the web and topic.... but it will duplicate the values whenever i extract from it...

    Example: listbox should contain:

    www.howTo.com
    3
    www.idea.com
    2

    But my coding gave me this:

    www.howTo.com
    3
    www.idea.com
    2
    www.howTo.com
    3
    www.idea.com
    2
    www.howTo.com
    3
    www.idea.com
    2
    www.howTo.com
    3
    www.idea.com
    2

    See, when i extract two sets of data, it will duplicate four sets instead...

    Thanks
    Last edited by toytoy; Jan 11th, 2005 at 12:38 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width