View previous topic :: View next topic |
Author |
Message |
yossarian
Joined: 21 Jun 2006 Posts: 8
|
Posted: Wed Jun 21, 2006 12:30 am Post subject: xpath |
|
|
hi guys,
i've ported tinyxml + tinyxpath library from c++ into d, and i think it could be useful for someone tinyxml port is complete, but xpath needs some (lot of) bugfixes.
should i ask for hosting on dsource? |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Fri Jun 30, 2006 1:19 am Post subject: |
|
|
Absolutely!
dsource could always use a good utility-set like this. What's performance like? |
|
Back to top |
|
|
yossarian
Joined: 21 Jun 2006 Posts: 8
|
Posted: Fri Jun 30, 2006 5:32 am Post subject: |
|
|
i haven't measured it's performance yet 'cos there is no similar tool in D, i have nothing to compare with |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Fri Jun 30, 2006 9:43 am Post subject: |
|
|
yossarian wrote: | i haven't measured it's performance yet 'cos there is no similar tool in D, i have nothing to compare with |
Compared to the original ... |
|
Back to top |
|
|
klassasin
Joined: 07 Jul 2006 Posts: 2 Location: Billings, MT, USA
|
Posted: Fri Jul 07, 2006 7:15 pm Post subject: A |
|
|
rss.d:
Code: |
import xpath.xpath_static;
import xpath.xpath_processor;
import std.stdio;
void main()
{
auto TiXmlDocument XDp_doc = new TiXmlDocument;
XDp_doc.LoadFile("rss.xml");
writefln("Expression: ?s, result: ?d", "count(/rss/channel/item)", i_xpath_int (XDp_doc.RootElement, "count(/rss/channel/item)"));
writefln("Expression: ?s, result: ?s", "/rss/channel/item[1]/pubDate/text()", S_xpath_string(XDp_doc.RootElement, "/rss/channel/item[1]/pubDate/text()"));
writefln("Expression: ?s, result: ?s", "/rss/channel/item[1]/link/text()", S_xpath_string(XDp_doc.RootElement, "/rss/channel/item[1]/link/text()"));
}
|
rss.xml:
Code: |
<rss version="2.0">
<channel>
<link>http://www.dsource.org/projects/tinyxpath/</link>
<description>a tiny C++ XPath processor (tinyxpath project)</description>
<generator>Notepad</generator>
<item>
<title>TinyXPath 0.9 released</title>
<description>The initial release is out!</description>
<author>the.yossarian@gmail.com Yossarian (original autor: Yves Berquin)</author>
<link>http://sourceforge.net/forum/forum.php?forum_id=345812</link>
<guid isPermaLink="true">http://sourceforge.net/forum/forum.php?forum_id=345812</guid>
<pubDate>Sun, 18 Jan 2004 13:33:55 GMT</pubDate>
</item>
</channel>
</rss>
|
Compiled: dmd rss tinyxpath.lib
Run: rss.exe
Results:
Code: |
Expression: count(/rss/channel/item), result: 1
Expression: /rss/channel/item[1]/pubDate/text(), result: Sun, 18 Jan 2004 13:33:55 GMT
Expression: /rss/channel/item[1]/link/text(), result: http://sourceforge.net/forum/forum.php?forum_id=345812
Error: Access Violation
|
Anyone know the reason for the error?
Also, I'm glad this project exists because I'm in need of a XML parser (or something close enough).
While I'm thinking, I'm particularly trying to parse an rss feed and list all of the <link>'s. Anyone know of a way to do it? _________________ * * * * * * * * * * * * * * * * * * * * * * * * * *
Here's to the men who did what was wrong but knew was right. |
|
Back to top |
|
|
yossarian
Joined: 21 Jun 2006 Posts: 8
|
Posted: Thu Jul 13, 2006 8:52 am Post subject: Re: A |
|
|
klassasin wrote: | rss.d:
Anyone know the reason for the error?
|
the error is raised while cleaning-up the application, and I really don't know where (no useable debugger), but i try to fix it in next release
klassasin wrote: |
While I'm thinking, I'm particularly trying to parse an rss feed and list all of the <link>'s. Anyone know of a way to do it? |
sure.
Code: | /rss/channel/item[*]/link/text() |
|
|
Back to top |
|
|
Crispy
Joined: 26 Nov 2005 Posts: 67
|
Posted: Mon Jul 24, 2006 11:28 pm Post subject: |
|
|
Just thought I'd drop in and say thanks for porting TinyXML - D has needed a good native XML library for a while now. Actually I was thinking about porting it myself until I saw this project! |
|
Back to top |
|
|
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Fri Aug 25, 2006 12:09 pm Post subject: |
|
|
Hi;
What's the current status of XMLTiny? What are the known bugs, limitations, etc?
Thx |
|
Back to top |
|
|
baxissimo
Joined: 23 Oct 2006 Posts: 241 Location: Tokyo, Japan
|
Posted: Tue May 01, 2007 12:56 am Post subject: Status |
|
|
Looks pretty dead to me. The issue with crash on exit with the test program still exists.
If you comment out the destructor in expression_result, however, the crash goes away. The gc seems to know about the objects (it's instances of node_set.) After putting writeflns in node_set's constructor and destructor, and putting std.gc.fullCollect() at the end of the test.d program, I get the same number of creations as destructions of node_set. And all node_sets reporting their destruction before program exit. So it seem that if the XML objects go out of scope these things indeed will not leak.
I'll post a patch that fixes that and some other things to a separate thread. |
|
Back to top |
|
|
|