GregFreeman Posted January 13, 2014 Report Share Posted January 13, 2014 I'm trying to use the DOM parser in LabVIEW and the HTML I'm trying to parse is throwing errors. I am wondering if someone can help me work around this. The device that is publishing the HTML is quite old and my knowledge with regards to HTML is limited. I've played around for a bit and been unable to get it to work so I figured I'd some here and see if anyone could troubleshoot. I'm open to minor manipulations to the HTML to get the parser to work, so feel free to modify as needed. test.html ParseHTML.vi Quote Link to comment
mje Posted January 13, 2014 Report Share Posted January 13, 2014 A quick look at the html source shows me it's old-school HTML, not XHTML. That 'X' is very important as it implies the content would be valid XML in addition to HTML. The LabVIEW DOM functions operate on the XML DOM, be it XHTML or any other XML, and demand valid data structures. If you want to parse (non X) HTML you'll probably have to do search and replace string operations. Either that or work some sort of browser engine into your code which can interpret HTML and allow you to operate on the HTML (not XML) DOM. 1 Quote Link to comment
GregFreeman Posted January 13, 2014 Author Report Share Posted January 13, 2014 (edited) This will be on a windows machine, maybe I can use .NET in LabVIEW, but we'll see. Is there something about regular HTML that itself would allow a generic parser not to be written and it's not worth digging for one? If that fails I'll just manipulate the string myself (ugh). Edited January 13, 2014 by for(imstuck) Quote Link to comment
JackDunaway Posted January 15, 2014 Report Share Posted January 15, 2014 Sooooo.... perhaps let's just short circuit and skip to regexes... how sophisticated exactly is this modification you're wanting to do? (related: attachment) For the future, here's a convenient link to test XHTML compliance of a document, as a "first-pass" check whether the LabVIEW DOM parser might have a rough go at it: http://validator.w3.org/ 1 Quote Link to comment
GregFreeman Posted January 15, 2014 Author Report Share Posted January 15, 2014 (edited) Whatttt? I didn't crash at all on mine and I ran lots of times. Must be your Mac (disregard if running in a Windows VM...which it looks like you are). This program I'm trying to write is generally simple. I don't actually have to modify the HTML, just pull a couple numbers out from the table. I was just open to modifying the HTML if there was a simple change that would make it compatible with the LabVIEW DOM Parser which wouldn't effect the data I needed to grab. That said, I will probably go the regex route, but it will be a good exercise for me. So, I'll post back if I get stuck on that. With all do respect, I'd like to forge (see: hack) ahead on my own for the time being, for learning's sake. Edited January 15, 2014 by for(imstuck) Quote Link to comment
Phillip Brooks Posted January 15, 2014 Report Share Posted January 15, 2014 Maybe this will help? Parsing HTML Table to LabVIEW 2D String http://lavag.org/topic/6483-parsing-html-table-to-labview-2d-string/ Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.