0

テキストを取得する必要がある次の html があります。

<place.tag theBID="Example of text here and there" percentage="512.6">
     <... other html tags here ...>
    <longer.bid type="string">
        This is an example of the longer bid here and there.
    </longer.bid>
     <... other html tags here ...>
</place.tag>

そして、これは私のVB.netコードです:

For Each listItem In doc.DocumentNode.SelectNodes("//place.tag[""longer.bid""]")
    Debug.Print(listItem.InnerText)
Next

("//place.tag[""longer.bid""]")部分で発生するエラーは次のとおりです。

Object reference not set to an instance of an object.

私はテキストを取得しようとしていますこれは、あちこちでより長い入札の例です。問題は、[@id=または[@class=を使用して値を取得できないことです。これは、HTML のタグごとにtheBIDが変更されるためです。

どんな助けでも素晴らしいでしょう!

4

1 に答える 1

0
For Each listItem In doc.DocumentNode.SelectNodes("//place.tag//longer.bid")
    Debug.Print(listItem.InnerText)
Next
于 2013-07-18T10:46:35.483 に答える