0

I parsed an entire HTML page into an ASTNode.

Snippet of it looks like this:

<div id="buildings-wrapper">
<div id="building-info"> 
<h2><span class="field-content">Britney Spears' House</span></h2> 
<div class="building-field"> 
<div class="field-content">9999 Hollywood Blvd</div> 
</div> 
<div class="building-field"> 
<div class="field-content">Building Hours: Mon. 07:00-23:00 Tue.-Fri. 06:30-22:00, Sat. 07:30-18:00, Sun. 12:00-18:00 Holidays - Closed</div> 
</div> 
<div class="building-field"> 
<div class="field-content"><a href="http://www.britneyspears.com">Locate on the stars map</a></div> 
</div> 
</div> 
<div id="building-image"> 
<div class="field-content"><img src="../../../../ssc.adm.britneyspears.com/classroomservices/image/viewimage?userEvent=ShowBuildingImage&amp;buildingID=britneyspears" alt="Image of BritneySpears"></div> 
    </div> 
    </div>

I need to grab some information from the page, like the name of the building and its address. How do I do that with an ASTNode? I've read the XML DOM tutorials and they suggest using document.getElementbyId and the ilk but I can't get to those functions from an ASTNode. I think I'm missing something simple but what's the easiest way to access the values I need?

falafel
  • 23
  • 3
  • 13
  • I would try jquery. It can be used on a server too. And it allows you to select elements the same way you do it in a browser. See this http://stackoverflow.com/a/4129032/3284355 – Molda Nov 07 '16 at 09:13
  • @Molda I can't use jQuery (it's for school). Should I do a depth-first tree traversal or something like that? Would that work for ASTNode? – falafel Nov 08 '16 at 00:06
  • Unfortunately I don't know what you mean by astnode. Can you possibly show how did you get the astnode? Add a snippet of code to your question if you can. And this is server-side, right? Isn't this astnode by any chance just a string variable with the html code? – Molda Nov 08 '16 at 11:51

0 Answers0