Jump to page: 1 2
Thread overview
HTML Parsing lib
Oct 25, 2014
Suliman
Oct 25, 2014
MrSmith
Oct 25, 2014
MrSmith
Oct 25, 2014
Suliman
Oct 25, 2014
Suliman
Oct 25, 2014
Suliman
Oct 25, 2014
MrSmith
Oct 26, 2014
Suliman
Oct 28, 2014
Chris
Oct 25, 2014
Adam D. Ruppe
Oct 26, 2014
yazd
October 25, 2014
I found only https://github.com/Bystroushaak/DHTMLParser

But I can't get it work:
C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
find_links.obj(find_links)
 Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
LElement
find_links.obj(find_links)
 Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
--- errorlevel 2

Is there any other HTML parsing lib, or maybe someone do know how to get it's work. Look like it's not compatible with current version of DMD
October 25, 2014
On Saturday, 25 October 2014 at 19:44:25 UTC, Suliman wrote:
> I found only https://github.com/Bystroushaak/DHTMLParser
>
> But I can't get it work:
> C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d
> OPTLINK (R) for Win32  Release 8.00.15
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
> LElement
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
> --- errorlevel 2
>
> Is there any other HTML parsing lib, or maybe someone do know how to get it's work. Look like it's not compatible with current version of DMD

You need to pass a library to compiler as well (all its files or .lib/.a file) if it is compiled as static library
October 25, 2014
On Saturday, 25 October 2014 at 19:46:01 UTC, MrSmith wrote:
> On Saturday, 25 October 2014 at 19:44:25 UTC, Suliman wrote:
>> I found only https://github.com/Bystroushaak/DHTMLParser
>>
>> But I can't get it work:
>> C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d
>> OPTLINK (R) for Win32  Release 8.00.15
>> Copyright (C) Digital Mars 1989-2013  All rights reserved.
>> http://www.digitalmars.com/ctg/optlink.html
>> find_links.obj(find_links)
>> Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
>> LElement
>> find_links.obj(find_links)
>> Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
>> --- errorlevel 2
>>
>> Is there any other HTML parsing lib, or maybe someone do know how to get it's work. Look like it's not compatible with current version of DMD
>
> You need to pass a library to compiler as well (all its files or .lib/.a file) if it is compiled as static library

You can try
dmd find_links.d dhtmlparser.d quote_escaper.d
October 25, 2014
>> You need to pass a library to compiler as well (all its files or .lib/.a file) if it is compiled as static library
>
> You can try
> dmd find_links.d dhtmlparser.d quote_escaper.d


C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d quote_escaper.d
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
find_links.obj(find_links)
 Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
LElement
find_links.obj(find_links)
 Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
--- errorlevel 2
October 25, 2014
On Saturday, 25 October 2014 at 19:51:48 UTC, Suliman wrote:
>
>>> You need to pass a library to compiler as well (all its files or .lib/.a file) if it is compiled as static library
>>
>> You can try
>> dmd find_links.d dhtmlparser.d quote_escaper.d
>
>
> C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d quote_escaper.d
> OPTLINK (R) for Win32  Release 8.00.15
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
> LElement
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
> --- errorlevel 2

Sorry I missed dhtmlparser.d
October 25, 2014
How I can build such App with DUB?

October 25, 2014
On Saturday, 25 October 2014 at 19:55:10 UTC, Suliman wrote:
> How I can build such App with DUB?

Unfortunately that library has no dub package.
But you can include it in your project.

See info here http://code.dlang.org/package-format
October 25, 2014
Another option for html is my dom.d

https://github.com/adamdruppe/arsd

get dom.d and characterencodings.d in your project directory.

compile with dmd yourfile.d dom.d characterencodings.d

here's an example:

import arsd.dom;

void main() {
   auto document = new Document();

   // The example document will be defined inline here
   // We could also load the string from a file with
   // std.file.readText or the web with std.net.curl.get
   document.parseGarbage(`<html><head>
     <meta name="author" content="Adam D. Ruppe">
     <title>Test Document</title>
   </head>
   <body>
     <p>This is the first paragraph of our <a
href="test.html">test document</a>.
     <p>This second paragraph also has a <a
href="test2.html">link</a>.
     <p id="custom-paragraph">Old text</p>
   </body>
   </html>`);

   import std.stdio;
   // retrieve and print some meta information
   writeln(document.title);
   writeln(document.getMeta("author"));
   // show a paragraph’s text
   writeln(document.requireSelector("p").innerText);
   // modify all links
   document["a[href]"].setValue("source", "your-site");
   // change some html
   document.requireElementById("custom-paragraph").innerHTML =
"New <b>HTML</b>!";
   // show the new document
   writeln(document.toString());
}




You can replace the html string with something like
std.file.readText("yourfile.html"); too


My library is meant to give an api similar to javascript.


I don't use dub so idk about how to use that, I just recommend
adding my files to your project if you wanna try it.
October 26, 2014
> Unfortunately that library has no dub package.
> But you can include it in your project.
>
> See info here http://code.dlang.org/package-format

I can't understand how to set in dub that I need to to include in compilation process other files... Could you help me?

October 26, 2014
On Saturday, 25 October 2014 at 19:44:25 UTC, Suliman wrote:
> I found only https://github.com/Bystroushaak/DHTMLParser
>
> But I can't get it work:
> C:\Users\Dima\Downloads\DHTMLParser-master\DHTMLParser-master>dmd find_links.d
> OPTLINK (R) for Win32  Release 8.00.15
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser11parseStringFAyaZC11dhtmlparser11HTM
> LElement
> find_links.obj(find_links)
>  Error 42: Symbol Undefined _D11dhtmlparser12__ModuleInfoZ
> --- errorlevel 2
>
> Is there any other HTML parsing lib, or maybe someone do know how to get it's work. Look like it's not compatible with current version of DMD

You can try https://github.com/bakkdoor/gumbo-d
« First   ‹ Prev
1 2