Beispiel #1
0
def name_utf8(name, tag='public'):
    names = tuple(netstring.decode(name)) or (name, )
    if len(names) > 1:
        return '<%s names="%s">%s</%s>' % (tag, xml_utf8.xml_attr(
            name), ''.join([name_utf8(n, tag) for n in names]), tag)

    return '<%s>%s</%s>' % (tag, xml_tf8.xml_cdata(name), tag)
Beispiel #2
0
def statement_utf8(model, prefixes):
    e, children = pns_to_xml_utf8(model)
    if children:
        e.xml_children = []
        for child in netstring.decode(children):
            subject, name = netstring.decode(child)
            if subject:
                e.xml_children.append(
                    '<%s pns="%s"/>' %
                    (''.join(xml_utf8.xml_prefix_FQN(
                        name, prefixes)), xml_utf8.xml_attr(subject)))
            else:
                e.xml_children.append('<%s />' %
                                      xml_utf8.xml_prefix_FQN(name, prefixes))
    return xml_utf8.xml_prefixed(e, prefixes,
                                 ' context="%s"' % xml_utf8.xml_attr(model[3]))
def name_utf8 (name, tag='public'):
        names = tuple (netstring.decode (name)) or (name,)
        if len (names) > 1:
                return '<%s names="%s">%s</%s>' % (
                        tag,
                        xml_utf8.xml_attr (name), 
                        ''.join ([name_utf8 (n, tag) for n in names]),
                        tag
                        )

        return '<%s>%s</%s>' % (tag, xml_tf8.xml_cdata (name), tag)
def statement_utf8 (model, prefixes):
        e, children = pns_to_xml_utf8 (model)
        if children:
                e.xml_children = []
                for child in netstring.decode (children):
                        subject, name = netstring.decode (child)
                        if subject:
                                e.xml_children.append ('<%s pns="%s"/>' % (
                                        ''.join (xml_utf8.xml_prefix_FQN (
                                                name, prefixes
                                                )),
                                        xml_utf8.xml_attr (subject)
                                        ))
                        else:
                                e.xml_children.append (
                                        '<%s />' % xml_utf8.xml_prefix_FQN (
                                                name, prefixes
                                                )
                                        )
        return xml_utf8.xml_prefixed (
                e, prefixes, 
                ' context="%s"' % xml_utf8.xml_attr (model[3])
                )