4 ms·
I'll bet you a nickle that most of the pages you'd use this on are not properly formed XML.
by revicon 16y ago
I'll bet you a nickle that most of the pages you'd use this on are not properly formed XML.
- pjscott 16y agoNot as big a problem as you might think. Just feed them to a parser designed to deal with broken HMTL, and then use XPath. I'm using lxml in Python for this, and it's working very well for me.
- timrobinson 16y agoLikewise on .NET, the HTML Agility Pack: http://htmlagilitypack.codeplex.com/ http://htmlagilitypack.codeplex.com/
- jrockway 16y agoNot a big deal. You can make a DOM from anything. In fact, the invalid case is exactly why you'd use this technique. If you use a bunch of regular expressions, you can probably make something that works on a subset of valid inputs. If you want it to work on everything, then you need to use a parser to generate a DOM, and then interact with the DOM.