Android Question Solved - MiniHtmlParser FindDirectNodes multiple lines of same

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have an html file I am trying to parse that has multiple division lines that are the same
B4X:
 <div class="pageSection bowlersSection"></div>

I tried to use
B4X:
Dim xRoot         As HtmlNode = mHtmlParser.Parse(LeaguePals_Data)
                           
Dim BowlerList     As List = mHtmlParser.FindDirectNodes(xRoot, "div", mHtmlParser.CreateHtmlAttribute("class", "pageSection bowlersSection"))

But always get a empty list and I know that there are at least 3 of this divisions in the file.

What is the proper way to use FindDirectNodes for something like this

NOTE: if I use FindNode I only get the first occurrence of this division and can't figure out how to get the others
B4X:
          Dim BowlerList     As HtmlNode = mHtmlParser.FindNode(xRoot, "div", mHtmlParser.CreateHtmlAttribute("class", "pageSection bowlersSection"))
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Seems I cannot use xRoot to search for the divisions with FindDirectNodes

So I searched for the the first division
B4X:
            Dim PDFExport        As HtmlNode = mHtmlParser.FindNode(xRoot, "div", mHtmlParser.CreateHtmlAttribute("class", "exportTOPDF"))

Then I could search for the individual divisions under it
B4X:
Dim BowlerList     As List = mHtmlParser.FindDirectNodes(xRoot, "div", mHtmlParser.CreateHtmlAttribute("class", "pageSection bowlersSection"))
 
Upvote 0
Top