Did I find the right examples for you? yes no

All Samples(9)  |  Call(7)  |  Derive(0)  |  Import(2)

src/a/k/Akara-2.0.0a4/demo/etc/MoinMoin/action/atom_rc.py   Akara(Download)
from MoinMoin.wikixml.util import RssGenerator
 
from amara.writers.struct import structencoder, E, E_CURSOR, NS, ROOT, RAW
from amara.namespaces import ATOM_NAMESPACE
 
                NS(u'', ATOM_NAMESPACE),
                NS(u'wiki', RSSWIKI_NAMESPACE),
                E_CURSOR((ATOM_NAMESPACE, u'feed'),
              )
            )

src/a/m/Amara-2.0.0/test/writers/test_struct.py   Amara(Download)
import amara
from amara.lib import treecompare
from amara.writers.struct import structwriter, structencoder, E, NS, ROOT, RAW, E_CURSOR
#from amara import tree
#from amara import bindery
def test_coroutine_example1():
    EXPECTED = """<a><b attr1="val1"><c>1</c><c>2</c><c>3</c></b></a>"""
    output = structencoder()
    f = output.cofeed(ROOT(E(u'a', E_CURSOR(u'b', {u'attr1': u'val1'}))))
    f.send(E(u'c', u'1'))
def test_coroutine_example2():
    EXPECTED = """<b attr1="val1"><c>1</c><c>2</c><c>3</c></b>"""
    output = structencoder()
    f = output.cofeed(ROOT(E_CURSOR(u'b', {u'attr1': u'val1'})))
    f.send(E(u'c', u'1'))
def test_coroutine_with_nsdecls1():
    EXPECTED = """<a xmlns="urn:bogus:x"><b attr1="val1"><c>1</c><c>2</c><c>3</c></b></a>"""
    XNS = u'urn:bogus:x'
    output = structencoder()
    f = output.cofeed(ROOT(E(u'a', NS(None, XNS), E_CURSOR(u'b', {u'attr1': u'val1'}))))
    XNS = u'urn:bogus:x'
    output = structencoder()
    f = output.cofeed(ROOT(E(u'a', NS(None, XNS), E_CURSOR((XNS, u'b'), {u'attr1': u'val1'}))))
    f.send(E((XNS, u'c'), u'1'))
    f.send(E((XNS, u'c'), u'2'))