Results 1 to 3 of 3

Thread: [2008] HTML value between TAGS

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    36

    [2008] HTML value between TAGS

    I have a HTMLDocument, and in it there are a number of TAGS with a value between them:

    Code:
    <COLUMN><NAME>Subject</NAME></COLUMN>
    <COLUMN><NAME>Status</NAME></COLUMN>
    <COLUMN><NAME>Description</NAME></COLUMN>
    I am struggling to get the values Subject, Status, Description from the HTML. This is what I am trying to do right now...

    Code:
    For Each htmlEl In htmlData.GetElementsByTagName("Name")
       arrColumns(iCurCount).name = htmlEl.OuterHtml
    Next
    But this simply returns <NAME>.
    OuterText, InnerText,InnerHTML all return Nothing, and children = 0.

    I'm guessing Element level is the wrong place to be, but I don't see any other way around it.

    Anybody have any experience in extracting this data?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: [2008] HTML value between TAGS

    this works:

    vb Code:
    1. Dim htmlData As New Xml.XmlDocument
    2. htmlData.LoadXml(html)
    3. 'change xpath in selectnodes
    4. For Each node As XmlNode In htmlData.SelectNodes("File/COLUMN/NAME")
    5.     MsgBox(node.InnerText)
    6. Next

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2007
    Posts
    36

    Re: [2008] HTML value between TAGS

    Thanks for that, back on the right track again

    The full HTML is badly formed, and shifting it to a XML class failed miserably. But for this section in isolation, I can do what you suggested.

    Thanks!

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