Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > [Announce] Gnosis Utils 1.1.0 (update)

Thread Tools

[Announce] Gnosis Utils 1.1.0 (update)

David Mertz, Ph.D.
Posts: n/a
** SECOND TRY (aaghh!)
** I bit the bullet and bought more bandwidth, this notice is
** updated to reflect the permanent URL for Gnosis Utilities

[Announce] Gnosis Utils 1.1.0

This release contains enhancements to gnosis.xml.objectify.

Added _XO_.__repr__ method to make nodes print in a nicer,
more compact fashion.

Added ._seq attribute to node objects to support structure
preserving convenience functions. Specifically, older
versions of gnosis.xml.objectify lost information about mixed
content and the order of children. E.g.,

>>> xml = '<foo>Mixed <i>content</i> is <b>good</b></foo>'
>>> obj = XO(xml,EXPAT).make_instance()
>>> obj.PCDATA, obj.i.PCDATA, obj.b.PCDATA

(u'Mixed is', u'content', u'good')

We had no way of knowing where inside <foo> the <i> and the
<b> occur, nor even which child element occurs first.

Now we can recover that information:

>>> from gnosis.xml.objectify import content, children
>>> content(obj)

[u'Mixed ', <i id="30264c">, u' is ', <b id="30292c">]
>>> children(obj)

[<i id="30264c">, <b id="30292c">]

Sequence information and convenience methods are NOT
SUPPORTED (yet?) for the DOM parser, only for EXPAT!

Changed default parser to EXPAT. If you have relied on the
special attribute ._XML that the DOM parser attaches to
nodes, you will now need to explicitly specify DOM as the
parser used. However, the new sequence functions pretty well
handle the job pyobj._XML used to do (in a different way).

Some newer versions of PyXML report CDATA as #cdata-section
nodes rather than as #text. We deal with it either way now.

It may be obtained at:

The current release is always available as:

Try it out, have fun, send feedback!

David Mertz ((E-Mail Removed))
Frank McIngvale ((E-Mail Removed))


BACKGROUND: Gnosis Utilities contains a number of Python libraries, most
(but not all) related to working with XML. These include:

gnosis.indexer (Full-text indexing/searching)
gnosis.xml.pickle (XML pickling of Python objects)
gnosis.xml.objectify (Any XML to "native" Python objects)
gnosis.xml.validity (Enforce validity constraints)
gnosis.xml.indexer (XPATH indexing of XML documents)
[...].convert.txt2html (Convert ASCII source files to HTML)
gnosis.util.dtd2sql (DTD -> SQL 'CREATE TABLE' statements)
gnosis.util.sql2dtd (SQL query -> DTD for query results)
gnosis.util.xml2sql (XML -> SQL 'INSERT INTO' statements)
gnosis.util.combinators (Combinatorial higher-order functions)
gnosis.util.introspect (Introspect Python objects)
gnosis.magic (Multimethods, metaclasses, etc)

....and so much more!

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Announce] Gnosis Utils 1.2.0 David Mertz, Ph.D. Python 0 04-07-2005 04:34 AM
dev-utils gem... How do I require_gem 'dev-utils/debug' ? Eirikur Hallgrimsson Ruby 3 10-10-2004 07:47 AM
in using ADS 1.2, does utils.h = Utils.h for example ... in windows XP arm developer C++ 0 06-03-2004 02:33 AM
[Announce] Gnosis Utils 1.1.1 David Mertz, Ph.D. Python 0 02-19-2004 05:40 AM
[Announce] Gnosis Utils 1.1.0 (update) Lulu of the Lotus-Eaters Python 0 07-16-2003 09:18 PM