Blog Yotsuba

Parse XML with Yotsuba 2

Yotsuba 2 has an incredible XML parsing module using CSS3 selecting algorithm. This is the short tutorial on how to use it.

First, we start with installation. You have two options here: using the source code (from SVN repo) or executing easy_install yotsuba.

Then, we start from importing Yotsuba.

import yotsuba

Then, read the file or string. In this case, you can either use the pre-instantiated parser kotoba (yotsuba.kotoba) or instantiate your own. In this example, I choose to use the pre-instantiated one to read an RSS-2.0-compatible file.

yotsuba.kotoba.read("rss2.xml");

Then, we want to get the title of the first item.

firstItemTitle = yotsuba.kotoba.get("item:first title").data();

That’s it. Just two lines and the knowledge of the standard (actually draft) CSS3 save your day.

If you want to see the complete documentation and examples, please visit at http://doc.shiroyuki.com/yotsuba/lib/kotoba.

Over 2400 downloads of Yotsuba 2

It is kinda paying off the time I’ve invest since I studied at UW. There have been currently 2406 downloads in total since February 16, 2008 or 1102 times that Yotsuba 2, including Yotsuba 2.0a1 – Yotsuba 2.2, has been downloaded since October 16, 2008.

I really wonder how other people download Yotsuba and use it without the proper documentation. But this is awesome that many people are interested in this project but sadly no body contributes it.

Yotsuba 2.2 Released

Yotsuba 2.2 is now officially released. This release is to resolve the problem in the undocumented module yotsuba.fs that causes yotsuba.XML and yotsuba.kotoba failed to parse an XML document on Windows platform. Also this release is to resolve the multithreading issue in yotsuba.XML. Thanks to Tim Mashinter of Primal Fusion Inc. to help me debug and fix the issue.

To install:

今日はプロジェクト「よつば」は新しいバーション(2.2)がリリースされました。今日、私とPrimal FusionのTim Mashinterさんは前のリリース(2.0 – 2.1)にモジュールyotsuba.fsのバグと、yotsuba.XMLとyotsuba.kotobaのmultithreadingサポット欠陥(バグ)を発見されました。

インストールのオプション:

Yotsuba 2.1 released

Yotsuba 2.1 is now officially released. This version is to resolve the problem in the undocumented module yotsuba.fs that causes yotsuba.XML and yotsuba.kotoba failed to parse an XML document on Windows platform. Thanks to Tim Mashinter of Primal Fusion Inc. to help me debug and fix the issue.

To install:

(more…)

Yotsuba 2 Released

In September 17, 2007, I decided to start a project to kill my time after study or assignments. It went well but it was too big and it wasn’t good enough in my opinion. After I started working at Primal Fusion, I spent a month and a half on planning. In August 15, 2009, the development of the second version of  Yotsuba emerged.

Unlike the first version (aiming to be a web framework), the second version is for general-purpose software development and experimenting on something interesting like parsing XML with CSS3 selector or simplifying mailing module.

It is also the first time that the second version of Yotsuba is available in the form of Python Egg Package and it is available via easy_install.

Later this October, I plan to make it available in the form of Debian Installer Package and to make it available via apt-get for Debian and Ubuntu if and only if I have time to do.

Visit http://yotsuba.shiroyuki.com

Copyright © Juti Noppornpitak. All rights reserved. Powered by WordPress. | Send message for feedback or assignment.