PyXB add schema location -
i wonder how pyxb add schema location generated xml, eg.
<ns1:mydocument xmlns:ns1="http://www.mydomain.com/path" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.mydomain.com/path myschema.xsd"> in jaxb i'd achieve
jaxbmarshaller.setproperty(marshaller.jaxb_schema_location, "http://www.mydomain.com/path myschema.xsd"); any idea how pyxb?
many thanks
there no automatic support this. can use todom() method , dom commands add attribute document. note that, unless use xsi namespace in document you'll have add too.
import xml.dom.minidom pyxb.namespace import xmlschema_instance xsi pyxb.namespace import xmlnamespaces xmlns v = instance.todom() v.documentelement.setattributens(xsi.uri(), 'xsi:schemalocation', 'urn:someurn') v.documentelement.setattributens(xmlns.uri(), 'xmlns:xsi', xsi.uri()) print v.toxml('utf-8')
Comments
Post a Comment