From e63aadb5223f152d9757178aa86db36796ae0f27 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Sat, 19 Jun 2010 20:28:53 +0200 Subject: saving work in progress stuff --- examples/ooxml-strict/dumpsample.py | 1 + examples/ooxml-strict/test.sh | 1 + examples/ooxml-strict/testppt.pptx | Bin 0 -> 34048 bytes examples/ooxml-strict/title-and-subtitle.pptx | Bin 0 -> 34696 bytes pyxb/binding/basis.py | 4 ++++ pyxb/utils/saxdom.py | 11 +++++++---- 6 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 examples/ooxml-strict/testppt.pptx create mode 100644 examples/ooxml-strict/title-and-subtitle.pptx diff --git a/examples/ooxml-strict/dumpsample.py b/examples/ooxml-strict/dumpsample.py index f0cf8cf..377ee60 100644 --- a/examples/ooxml-strict/dumpsample.py +++ b/examples/ooxml-strict/dumpsample.py @@ -42,6 +42,7 @@ else: for i in range(worklist.iterations(mimetype)): contentIter() currOutFile = outDir+"/"+inFileName+str(iteration)+inFileExt + print sax_instance.toxml().encode('utf-8') package.copyWithReplace(currOutFile,{fragment: sax_instance.toxml().encode('utf-8')}) iteration += 1 print "Written "+currOutFile diff --git a/examples/ooxml-strict/test.sh b/examples/ooxml-strict/test.sh index 0263bd9..cb76603 100755 --- a/examples/ooxml-strict/test.sh +++ b/examples/ooxml-strict/test.sh @@ -8,3 +8,4 @@ sh genbindings.sh echo ; echo ; echo "Running demo iteration" ; echo ; echo python dumpsample.py demo Lorem-ipsum.docx /tmp python xls_sample.py demo_refmode test-refmode.xlsx /tmp +python dumpsample.py demo3 testppt.pptx /tmp diff --git a/examples/ooxml-strict/testppt.pptx b/examples/ooxml-strict/testppt.pptx new file mode 100644 index 0000000..da7e352 Binary files /dev/null and b/examples/ooxml-strict/testppt.pptx differ diff --git a/examples/ooxml-strict/title-and-subtitle.pptx b/examples/ooxml-strict/title-and-subtitle.pptx new file mode 100644 index 0000000..344b3a6 Binary files /dev/null and b/examples/ooxml-strict/title-and-subtitle.pptx differ diff --git a/pyxb/binding/basis.py b/pyxb/binding/basis.py index 5305955..7ff0688 100644 --- a/pyxb/binding/basis.py +++ b/pyxb/binding/basis.py @@ -2224,6 +2224,10 @@ class complexTypeDefinition (_TypeBinding_mixin, utility._DeconflictSymbols_mixi assert v != self if eu is None: if isinstance(v, xml.dom.Node): + print type(v) + print v.__dict__ + print element + print element.__dict__ element.appendChild(v) else: v.toDOM(dom_support, parent) diff --git a/pyxb/utils/saxdom.py b/pyxb/utils/saxdom.py index d5ffdae..ae45aa8 100644 --- a/pyxb/utils/saxdom.py +++ b/pyxb/utils/saxdom.py @@ -135,7 +135,7 @@ class Node (xml.dom.Node, pyxb.utils.utility.Locatable_mixin): self.__name = expanded_name.uriTuple() self.__namespaceURI = expanded_name.namespaceURI() self.__localName = expanded_name.localName() - self.__namespaceContext.setNodeContext(self) + #self.__namespaceContext.setNodeContext(self) location = property(lambda _s: _s._location()) @@ -155,7 +155,7 @@ class Node (xml.dom.Node, pyxb.utils.utility.Locatable_mixin): def _indexInParent (self): return self.__indexInParent - def __childIfPresent (self, index): + def _childIfPresent (self, index): if index < len(self.__childNodes): return self.__childNodes[index] return None @@ -164,6 +164,9 @@ class Node (xml.dom.Node, pyxb.utils.utility.Locatable_mixin): new_child._setParentNode(self, len(self.__childNodes)) self.__childNodes.append(new_child) + def removeChild (self, old_child): + pass + def _setParentNode (self, parent_node, index_in_parent): self.__parentNode = parent_node self.__indexInParent = index_in_parent @@ -175,11 +178,11 @@ class Node (xml.dom.Node, pyxb.utils.utility.Locatable_mixin): nodeType = property(lambda _s: _s.__nodeType) parentNode = property(lambda _s: _s.__parentNode) - firstChild = property(lambda _s: _s.__childIfPresent(0)) + firstChild = property(lambda _s: _s._childIfPresent(0)) childNodes = property(lambda _s: _s.__childNodes) attributes = property(lambda _s: _s.__attributes) - nextSibling = property(lambda _s: _s.parentNode.__childIfPresent(_s.__indexInParent+1)) + nextSibling = property(lambda _s: _s.parentNode._childIfPresent(_s.__indexInParent+1)) def hasAttributeNS (self, ns_uri, local_name): return self.getAttributeNodeNS(ns_uri, local_name) is not None -- cgit v1.2.3