Re: Extracting Structure from HTML using Adam's dom.d

2015-01-26 Thread Suliman via Digitalmars-d-learn
On Sunday, 25 January 2015 at 22:14:09 UTC, Adam D. Ruppe wrote: On Sunday, 25 January 2015 at 21:24:06 UTC, Suliman wrote: I need extract data inside rel (somedata) string s = element.rel; Do you mean something like this? string s = element.rel; foreach(row;

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-26 Thread Suliman via Digitalmars-d-learn
On Monday, 26 January 2015 at 17:24:23 UTC, Adam D. Ruppe wrote: On Monday, 26 January 2015 at 17:17:55 UTC, Suliman wrote: Do you mean something like this? I just mean to get the value of the rel=something attribute, use element.rel; assert(element.rel == something); The element is the

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-26 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 26 January 2015 at 17:17:55 UTC, Suliman wrote: Do you mean something like this? I just mean to get the value of the rel=something attribute, use element.rel; assert(element.rel == something); The element is the thing you see in the loop and stuff. querySelectorAll returns an

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-25 Thread Suliman via Digitalmars-d-learn
Adam, I understood how to select URLs, but how extract values of attributes from such selection? a href=/ class=post-tag title=show questions tagged 'javascript' rel=somedata I need extract data inside rel (somedata)

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 25 January 2015 at 21:24:06 UTC, Suliman wrote: I need extract data inside rel (somedata) string s = element.rel;

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 22 January 2015 at 11:23:49 UTC, Nordlöw wrote: What is the meaning of selectors such as `a[href]` used in doc.querySelectorAll(`a[href]`) ? Select all `a` tags that have a `href` attribute. You can also select using the attribute value too. For example get all the

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Nordlöw
On Thursday, 22 January 2015 at 02:06:16 UTC, Adam D. Ruppe wrote: You can do that with a CSS selector like: document.querySelector(#H2_A + p); What is the meaning of selectors such as `a[href]` used in doc.querySelectorAll(`a[href]`) ?

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Suliman via Digitalmars-d-learn
Adam, please add more simple docs about your parser on site. Also it would be perfect to create dub, for easier including parser to project.

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread via Digitalmars-d-learn
On Thursday, 22 January 2015 at 02:06:16 UTC, Adam D. Ruppe wrote: On Wednesday, 21 January 2015 at 23:31:26 UTC, Nordlöw wrote: This means that I need some kind of interface to extract all the contents of each p paragraph that is preceeded by a h2 heading with a specific id (say H2_A) or

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 January 2015 at 16:22:14 UTC, ketmar via Digitalmars-d-learn wrote: i miss it in Phobos. I'm sure it'd fail the phobos review process though. But since it is an independent file (or it + characterencodings.d for full functionality), it is easy to just download and add to your

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 January 2015 at 10:14:58 UTC, Suliman wrote: Adam, please add more simple docs about your parser on site. I'll post some ddoc in the next dmd release, now that dmd finally supports some way to automatically escape xml examples. Also it would be perfect to create dub, for

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread ketmar via Digitalmars-d-learn
On Thu, 22 Jan 2015 18:39:25 +, Adam D. Ruppe wrote: On Thursday, 22 January 2015 at 16:22:14 UTC, ketmar via Digitalmars-d-learn wrote: i miss it in Phobos. I'm sure it'd fail the phobos review process though. But since it is an independent file (or it + characterencodings.d for full

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread ketmar via Digitalmars-d-learn
On Thu, 22 Jan 2015 11:40:52 + Gary Willoughby via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Thursday, 22 January 2015 at 11:23:49 UTC, Nordlöw wrote: What is the meaning of selectors such as `a[href]` used in doc.querySelectorAll(`a[href]`) ?

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 January 2015 at 09:27:17 UTC, Per Nordlöw wrote: BTW: Would you be interested in receiving a PR for dom.d where I replace array allocations with calls to lazy ranges? Maybe. It was on my todo list to do that for getElementsByTagName at least, which is supposed to be a live

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 January 2015 at 11:40:53 UTC, Gary Willoughby wrote: doc.querySelectorAll(`form[name=myform] input[type=text]`) dom.d is awesome! Something to remember btw is this also works in browser JavaScript AND css itself, since IE8 and Firefox 3.5. (no need for slow, bloated jquery)

Extracting Structure from HTML using Adam's dom.d

2015-01-21 Thread Nordlöw
I'm trying to figure out how to most easily extract structured information using Adam D Ruppe's dom.d. Typically I want the following HTML example ... h2 span class=mw-headline id=H2_AMore important/span /h2 pThis is iimportant/i./p h2 span class=mw-headline id=H2_BLess important/span /h2

Re: Extracting Structure from HTML using Adam's dom.d

2015-01-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 21 January 2015 at 23:31:26 UTC, Nordlöw wrote: This means that I need some kind of interface to extract all the contents of each p paragraph that is preceeded by a h2 heading with a specific id (say H2_A) or content (say More important). How do I accomplish that? You can do