How to use ipo - 2 common examples

To help you get started, we’ve selected a few ipo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pabigot / pyxb / examples / xsdprimer / saxdemo.py View on Github external
from __future__ import print_function
xml_file = 'ipo.xml'

import pyxb.binding.saxer
import ipo

def ShowOrder (order):
    print('%s is sending %s %d thing(s):' % (order.billTo.name, order.shipTo.name, len(order.items.item)))
    for item in order.items.item:
        print('  Quantity %d of %s at $%s' % (item.quantity, item.productName, item.USPrice))

if False:
    import pyxb.utils.domutils
    xmld = pyxb.utils.domutils.StringToDOM(open(xml_file).read())
    dom_value = ipo.CreateFromDOM(xmld.documentElement)
    ShowOrder(dom_value)

saxer = pyxb.binding.saxer.make_parser()
handler = saxer.getContentHandler()
saxer.parse(open(xml_file))
ShowOrder(handler.rootObject())
github pabigot / pyxb / examples / xsdprimer / demo.py View on Github external
from __future__ import print_function
import pyxb
import ipo
import xml.dom.minidom
import time
import io

xmld = open('ipo.xml', 'rb').read()

order = ipo.CreateFromDOM(xml.dom.minidom.parse(io.BytesIO(xmld)).documentElement)

print('%s is sending %s %d thing(s):' % (order.billTo.name, order.shipTo.name, len(order.items.item)))
for item in order.items.item:
    print('  Quantity %d of %s at $%s' % (item.quantity, item.productName, item.USPrice))

# Give Mary more
try:
    item.quantity = 100;
except pyxb.SimpleTypeValueError as e:
    print('Too many: %s' % (e,))
    item.quantity = 10;
print('Increased quantity to %d' % (item.quantity,))

ipo

Infix piping operator

LGPL-3.0
Latest version published 1 year ago

Package Health Score

41 / 100
Full package analysis

Popular ipo functions

Similar packages