html-parsing

php regex to extract data from HTML table

六月ゝ 毕业季﹏ 提交于 2019-12-18 12:45:00
问题 I'm trying to make a regex for taking some data out of a table. the code i've got now is: <table> <tr> <td>quote1</td> <td>have you trying it off and on again ?</td> </tr> <tr> <td>quote65</td> <td>You wouldn't steal a helmet of a policeman</td> </tr> </table> This I want to replace by: quote1:have you trying it off and on again ? quote65:You wouldn't steal a helmet of a policeman the code that I already have written is this: %<td>((?s).*?)</td>% But now I'm stuck. 回答1: Tim's regex probably

What does HTML Parsing mean? [closed]

旧巷老猫 提交于 2019-12-18 11:38:01
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I have heard of HTML Parser libraries like Simple HTML DOM and HTML Parser. I have also heard of questions containing HTML Parsing. What does it mean to parse HTML? 回答1: Unlike what Spudley said, parsing is basically to resolve (a sentence) into its component parts and describe

Problem with HTML Parser in IE

会有一股神秘感。 提交于 2019-12-18 10:46:17
问题 I am trying to create a dialog box that will appear only if the browser selected is IE (any version) however I get this error: Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917) That's all in "Line/Char/Code" 0 so I do not know where is the error. The code I'm using is this: <script type="text/javascript"> <!-- if(BrowserDetect.browser.contains("Explorer")) { var Nachricht = 'Hemos detectado que está utilizando ' +

What is parsing?

六眼飞鱼酱① 提交于 2019-12-18 10:05:50
问题 Parsing is something I came accross alot in development, but as a junior its one of those things I assume I will get the hang of at some point, when its needed. In my current project I've been told to find and use an HTML parser for a certain function, I have found a couple on the web, but what does an HTML parser actually do? And what does it mean to parse an object?? 回答1: Parsing usually applies to text - the act of reading text and converting it into a more useful in-memory format,

How can I add “current streak” of contributions from github to my blog?

Deadly 提交于 2019-12-18 10:01:48
问题 I have a personal blog I built using rails. I want to add a section to my site that displays my current streak of github contributions. What would be the best way about doing this? edit: for clarification, here is what I want: just the number of days is all that is necessary for me. 回答1: Considering the GitHub API for Users doesn't yet expose that particular information (number of days for current stream of contributions), you might have to: scrape it (extract it by reading the user's GitHub

JSOUP adding extra encoded stuff for an html

点点圈 提交于 2019-12-18 09:49:22
问题 Actually JSOUP is adding some extra encoded values to my HTML in my jSOUP parser.I am trying to take care of it by String url = "http://iqtestsites.adtech.de/pictelatest/custombkgd/StylelistDevil.html"; System.out.println("Fetching %s..."+url); Document doc = Jsoup.connect(url).get(); //System.out.println(doc.html()); Document.OutputSettings settings = doc.outputSettings(); settings.prettyPrint(false); settings.escapeMode(Entities.EscapeMode.base); settings.charset("ASCII"); String html = doc

Regex ignore matches between <script> tags

前提是你 提交于 2019-12-18 09:38:01
问题 I apologise as I have very little knowledge about Regex and I don't even understand exactly what this regex is doing (I didn't write it - source) apart from the fact it searches for a certain term so that it can be highlighted. Here is the Regex: /(\b$term|$term\b)(?!([^<]+)?>)/iu The problem is I need to make sure it doesn't match anything between <script> and </script> tags. Now I know there are many variations of how a script tag can be written but really all I need it to do is ignore any

How to get the contents of a HTML element using HtmlAgilityPack in C#?

≡放荡痞女 提交于 2019-12-18 08:53:43
问题 I want to get the contents of an ordered list from a HTML page using HTMLAgilityPack in C#, i have tried the following code but, this is not working can anyone help, i want to pass html text and get the contents of the first ordered list found in the html private bool isOrderedList(HtmlNode node) { if (node.NodeType == HtmlNodeType.Element) { if (node.Name.ToLower() == "ol") return true; else return false; } else return false; } public string GetOlList(string htmlText) { string s="";

lxml truncates text that contains 'less than' character

独自空忆成欢 提交于 2019-12-18 06:21:23
问题 >>> s = '<div> < 20 </div>' >>> import lxml.html >>> tree = lxml.html.fromstring(s) >>> lxml.etree.tostring(tree) '<div> </div>' Does anybody know any workaround for this? 回答1: Your HTML input is broken; that < left angle bracket should have been encoded to < instead. From the lxml documentation on parsing broken HTML: The support for parsing broken HTML depends entirely on libxml2's recovery algorithm. It is not the fault of lxml if you find documents that are so heavily broken that the

lxml truncates text that contains 'less than' character

混江龙づ霸主 提交于 2019-12-18 06:21:10
问题 >>> s = '<div> < 20 </div>' >>> import lxml.html >>> tree = lxml.html.fromstring(s) >>> lxml.etree.tostring(tree) '<div> </div>' Does anybody know any workaround for this? 回答1: Your HTML input is broken; that < left angle bracket should have been encoded to < instead. From the lxml documentation on parsing broken HTML: The support for parsing broken HTML depends entirely on libxml2's recovery algorithm. It is not the fault of lxml if you find documents that are so heavily broken that the