Amara 2 domlette and XPath ready for test

3 views
Skip to first unread message

Uche Ogbuji

unread,
Apr 19, 2008, 10:09:01 AM4/19/08
to amara...@googlegroups.com
We've made pretty good progress, and there are some things that the more
adventurous users might want to try out, at least to get a feel for the
new package structure. Right now you can parse to create domlette
trees, and you can use XPath. That alone is enough for a lot of tasks.

Use Mercurial to pull the latest from here:

http://hg.4suite.org/amara/trunk/

You can try out Amara 2 without mucking with your Amara 1.x installation
using virtualenv.

http://pypi.python.org/pypi/virtualenv

I have a few notes here. See the "Test sandbox" heading:

http://wiki.xml3k.org/Amara2/Developer_notes

Here is a small test session:

--%<--
from itertools import *
from amara.xpath.parser import parse as xpathparse
from amara.xpath import context as xpathcontext
from amara.domlette import NonvalParse
from amara.lib import inputsource

XML = ''.join(chain(['<a><b>'], [ '<c/>' for i in xrange(5000) ],
['</b></a>']))
doc = NonvalParse(inputsource(XML), 'urn:bogus')
ctx = xpathcontext(doc)

print xpathparse('a').evaluate(ctx)
print len(xpathparse('//c').evaluate(ctx))
--%<--

Yes "amara.domlette.NonvalParse" is the legacy name. It will change.
There is still some legacy sprinkled about.

Also, there are still a lot of debug statements for XPath. You can
disable the debugging by commenting out the define in
amara/src/expat/debug.h:

#define DEBUG_ALL

You can already see much of the performance improvements for Amara 2.x.

--
Uche Ogbuji http://uche.ogbuji.net
Founding Partner, Zepheira http://zepheira.com
Linked-in profile: http://www.linkedin.com/in/ ucheogbuji
Articles: http://uche.ogbuji.net/tech/publications/

Reply all
Reply to author
Forward
0 new messages