Browse Source

----------------------------------------------------------------------

Modified Files:
 	Utility.py -- change to accomodate writing out XML instances
		w/o SOAP Envelopes, "known" prefixes aren't "known"
		when the Envelope isn't writen out.


 ----------------------------------------------------------------------
main
Joshua Boverhof 20 years ago
parent
commit
d8066fd6c7
1 changed files with 14 additions and 3 deletions
  1. +14
    -3
      Utility.py

+ 14
- 3
Utility.py View File

@@ -498,6 +498,8 @@ class DOM:
DOCUMENT_NODE = node.DOCUMENT_NODE DOCUMENT_NODE = node.DOCUMENT_NODE
ELEMENT_NODE = node.ELEMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE
while 1: while 1:
if node is None:
raise DOMException('Value for prefix %s not found.' % prefix)
if node.nodeType != ELEMENT_NODE: if node.nodeType != ELEMENT_NODE:
node = node.parentNode node = node.parentNode
continue continue
@@ -891,10 +893,17 @@ class ElementProxy(Base, MessageInterface):
return self.canonicalize() return self.canonicalize()


def createDocument(self, namespaceURI, localName, doctype=None): def createDocument(self, namespaceURI, localName, doctype=None):
'''If specified must be a SOAP envelope, else may contruct an empty document.
'''
prefix = self._soap_env_prefix prefix = self._soap_env_prefix
if namespaceURI != self.reserved_ns[prefix]:

if namespaceURI == self.reserved_ns[prefix]:
qualifiedName = '%s:%s' %(prefix,localName)
elif namespaceURI is localName is None:
self.node = self._dom.createDocument(None,None,None)
return
else:
raise KeyError, 'only support creation of document in %s' %self.reserved_ns[prefix] raise KeyError, 'only support creation of document in %s' %self.reserved_ns[prefix]
qualifiedName = '%s:%s' %(prefix,localName)


document = self._dom.createDocument(nsuri=namespaceURI, qname=qualifiedName, doctype=doctype) document = self._dom.createDocument(nsuri=namespaceURI, qname=qualifiedName, doctype=doctype)
self.node = document.childNodes[0] self.node = document.childNodes[0]
@@ -922,7 +931,9 @@ class ElementProxy(Base, MessageInterface):
value = localName value = localName
if namespaceURI: if namespaceURI:
value = '%s:%s' %(self.getPrefix(namespaceURI),localName) value = '%s:%s' %(self.getPrefix(namespaceURI),localName)
self._setAttributeNS(self._xsi_nsuri, '%s:type' %self._xsi_prefix, value)

xsi_prefix = self.getPrefix(self._xsi_nsuri)
self._setAttributeNS(self._xsi_nsuri, '%s:type' %xsi_prefix, value)


def createAttributeNS(self, namespace, name, value): def createAttributeNS(self, namespace, name, value):
document = self._getOwnerDocument() document = self._getOwnerDocument()


Loading…
Cancel
Save