Reputation: 5709
I got some HTML that reads <span class=""...></span>
I want to use JSoup to get what is between these two tags, but I only have one other identifier on those span classes, and it's <...attr="?"...></span>
The ? is an auto generated number starting at 0. How would I go about getting the content in the span tag? I seem to have few choices in identifiers.
Upvotes: 0
Views: 1192
Reputation: 723729
Use an attribute selector, where attr
is the name of the attribute. You can leave out the attribute value if you're not interested in it, and you can pretty much ignore the class
attribute altogether:
Element span = doc.select("span[attr]").first();
String spanText = span.text();
Upvotes: 2