FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

xpath

 
Post new topic   Reply to topic     Forum Index -> TinyXPath
View previous topic :: View next topic  
Author Message
yossarian



Joined: 21 Jun 2006
Posts: 8

PostPosted: Wed Jun 21, 2006 12:30 am    Post subject: xpath Reply with quote

hi guys,
i've ported tinyxml + tinyxpath library from c++ into d, and i think it could be useful for someone Smile tinyxml port is complete, but xpath needs some (lot of) bugfixes.
should i ask for hosting on dsource?
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Fri Jun 30, 2006 1:19 am    Post subject: Reply with quote

Absolutely! Smile

dsource could always use a good utility-set like this. What's performance like?
Back to top
View user's profile Send private message
yossarian



Joined: 21 Jun 2006
Posts: 8

PostPosted: Fri Jun 30, 2006 5:32 am    Post subject: Reply with quote

i haven't measured it's performance yet Smile 'cos there is no similar tool in D, i have nothing to compare with Smile
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Fri Jun 30, 2006 9:43 am    Post subject: Reply with quote

yossarian wrote:
i haven't measured it's performance yet Smile 'cos there is no similar tool in D, i have nothing to compare with Smile

Compared to the original ...
Back to top
View user's profile Send private message
klassasin



Joined: 07 Jul 2006
Posts: 2
Location: Billings, MT, USA

PostPosted: Fri Jul 07, 2006 7:15 pm    Post subject: A Reply with quote

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
View user's profile Send private message AIM Address MSN Messenger
yossarian



Joined: 21 Jun 2006
Posts: 8

PostPosted: Thu Jul 13, 2006 8:52 am    Post subject: Re: A Reply with quote

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
View user's profile Send private message
Crispy



Joined: 26 Nov 2005
Posts: 67

PostPosted: Mon Jul 24, 2006 11:28 pm    Post subject: Reply with quote

Just thought I'd drop in and say thanks for porting TinyXML - D has needed a good native XML library for a while now. Smile Actually I was thinking about porting it myself until I saw this project! Cool
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Fri Aug 25, 2006 12:09 pm    Post subject: Reply with quote

Hi;

What's the current status of XMLTiny? What are the known bugs, limitations, etc?

Thx Smile
Back to top
View user's profile Send private message
baxissimo



Joined: 23 Oct 2006
Posts: 241
Location: Tokyo, Japan

PostPosted: Tue May 01, 2007 12:56 am    Post subject: Status Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> TinyXPath All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group