amara.domlette API change

1 view
Skip to first unread message

Jeremy Kloth

unread,
May 12, 2008, 1:28:45 PM5/12/08
to Amara Developers
The latest revision has the updated function signatures to match the new
naming conventions:

NonvalParse(isrc, readExtDtd, nodeFactories) -> parse(source, flags,
node_factories)
ValParse(isrc, nodeFactories) -> parse(source, PARSE_FLAGS_VALIDATE,
node_factories)

where flags is now one of:
PARSE_FLAGS_STANDALONE - no parsed external entities (or external DTD)
PARSE_FLAGS_EXTERNAL_ENTITIES - external entities (and external DTD) parsed
PARSE_FLAGS_VALIDATE - external entities & validation

and

ParseFragment(isrc, namespaces, nodeFactories) -> parse_fragment(source,
namespaces, node_factories)

Thanks,
Jeremy

Uche Ogbuji

unread,
May 12, 2008, 1:48:32 PM5/12/08
to amar...@googlegroups.com

I just wanted to clarify a bit. All the above is in the amara.domlette
namespace, so:


from amara.domlette import parse, PARSE_FLAGS_VALIDATE #Or you can use *
...
doc = parse(source, node_factories=mynodes) #no flags
doc1 = parse(source, PARSE_FLAGS_VALIDATE, mynodes)

The default amara.parse will be amara.bindery.parse (once this is written)

import amara
...
doc = amara.parse(source)
print doc.spam.eggs.xml()

--
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