Did I find the right examples for you? yes no

All Samples(11)  |  Call(8)  |  Derive(0)  |  Import(3)
XML/HTML writer (serializer) that works on Python objects that proxy
XML structure (similar to, but simpler and more and directly geared to
serialization than amara.tree and bindery nodes).  Buffers the serialized
result, for retrieval as a string using the read() method.

Usage examples:

from amara.writers.struct import structencoder, E, NS, ROOT, RAW
output = structencoder(indent=u"yes")
output.feed((more...)

src/a/k/Akara-2.0.0a4/lib/demo/moinrest.py   Akara(Download)
import amara
from amara import bindery
from amara.writers.struct import structencoder, E, NS, ROOT, RAW
from amara.bindery.html import parse as htmlparse
from amara.bindery.model import examplotron_model, generate_metadata
                target = [ param.split('=', 1)[1] for param in node.href.split(u'&') if param.startswith('target=') ][0]
                targets.append(target)
            output = structencoder(indent=u"yes")
            output.feed(
            ROOT(
        def upstream_handler():
            revs = scrape_page_history(page, base, opener, req_headers)
            output = structencoder(indent=u"yes")
            output.feed(
            ROOT(

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
 
 
        # prepare output
        output = structencoder(indent=u"yes")
 
        FEED_HEADER_COMMENT = '''

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'}))))
    EXPECTED = """<a><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((XNS, u'b'), {u'attr1': u'val1'}))))
    f.send(E((XNS, u'c'), u'1'))