Hi,
I'm trying to produce this XML:

<?xml version="1.0" encoding="UTF-8"?>  
<dat:dataPack id="008129" ico="63303396" application="app" version = "1.0" 
note="Import" xmlns:dat="http://www.stormware.cz/schema/data.xsd"; 
xmlns:inv="http://www.stormware.cz/schema/invoice.xsd";        
xmlns:vch="http://www.stormware.cz/schema/voucher.xsd";        
xmlns:int="http://www.stormware.cz/schema/intDoc.xsd";        
xmlns:typ="http://www.stormware.cz/schema/type.xsd"; >
<dat:dataPackItem id="1" version="1.0"> 
                <inv:invoice version="1.1">
                        <inv:invoiceHeader>
                                <inv:invoiceType>issuedInvoice</inv:invoiceType>
                                <inv:date>2010-06-28</inv:date>
                                <inv:accounting>
                                        <typ:ids>2Pslužb</typ:ids>
                                </inv:accounting>
                                <inv:classificationVAT>
                                        
<typ:classificationVATType>inland</typ:classificationVATType>
                                </inv:classificationVAT>
                                <inv:text>Here goes the text</inv:text>
                                <inv:partnerIdentity>
                                        <typ:id>240</typ:id>
                                </inv:partnerIdentity>
                                <inv:paymentType>
                                        <typ:ids>příkazem</typ:ids>
                                </inv:paymentType>
                                <inv:account>                                   
                                        <typ:accountNo>381957163</typ:accountNo>
                                        <typ:bankCode>0300</typ:bankCode>
                                </inv:account>
                                <inv:symConst>0308</inv:symConst>
                        </inv:invoiceHeader>                    
                        <inv:invoiceDetail>
                                <inv:invoiceItem>
                                        <inv:text>Here goes the text</inv:text>
                                        <inv:quantity>12</inv:quantity>
                                        <inv:unit>měs</inv:unit>
                                       <inv:rateVAT>high</inv:rateVAT>
                                        <inv:homeCurrency>
                                                
<typ:unitPrice>149.000000</typ:unitPrice>
                                        </inv:homeCurrency>
                                </inv:invoiceItem>
                        </inv:invoiceDetail>
                        <inv:invoiceSummary>
                                
<inv:roundingDocument>math2one</inv:roundingDocument>
                        </inv:invoiceSummary>
                </inv:invoice>
        </dat:dataPackItem>
</dat:dataPack>


I have created the binding with:
pyxbgen -u "http://www.stormware.cz/schema/data.xsd"; -m data

Now with the following script I'm trying to produce XML:

# -*- coding: utf-8 -*-
import pyxb
import data
from _inv import invoice
import time
import pyxb.utils.domutils

pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(data.Namespace, 'dat')
pyxb.utils.domutils.BindingDOMSupport.DeclareNamespace(invoice.Namespace, 'inv')

v=data.dataPack(ico="333",id="4567",application="app",version = 
"1.0",note="Import")
v.dataPackItem.append(invoice())
v.dataPackItem[0].invoice.version="1.0"

pyxb.RequireValidWhenGenerating(False)
print v.toxml()

Could you please help me with inner elemets like invoice, invoiceheader, etc? I 
can't het any further.

Thanks a lot,
David Hrbac

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
pyxb-users mailing list
pyxb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyxb-users

Reply via email to