Commits

Julian Rosse committed 0c6ef8b

pre-move

  • Participants
  • Parent commits 5e3cb18

Comments (0)

Files changed (4)

File pyces/dom.pxd

-cimport util
+from util cimport XMLCh
 
 cdef extern from "xercesc/dom/DOM.hpp" namespace "xercesc":
     cdef cppclass DOMDocument:
         DOMNode* getDocumentElement()
     cdef cppclass DOMNode:
-        util.XMLCh* getNodeName()
-        util.XMLCh* getNodeValue()
+        XMLCh* getNodeName()
+        XMLCh* getNodeValue()
         DOMNode* getFirstChild()
 
     cdef cppclass DOMElement:
-       util.XMLCh* getTagName()
+        XMLCh* getTagName()

File pyces/framework.pxd

-cimport util
-cimport sax
+from util cimport XMLByte, XMLSize_t
+from sax cimport InputSource
 
 cdef extern from "xercesc/framework/MemBufInputSource.hpp" namespace "xercesc":
-    cdef cppclass MemBufInputSource( sax.InputSource ):
-        MemBufInputSource( util.XMLByte*,
-                           util.XMLSize_t,
+    cdef cppclass MemBufInputSource( InputSource ):
+        MemBufInputSource( XMLByte*,
+                           XMLSize_t,
                            char* )

File pyces/parsers.pxd

-cimport sax
-cimport dom
+from sax cimport InputSource
+from dom cimport DOMDocument
 
 cdef extern from "xercesc/parsers/XercesDOMParser.hpp" namespace "xercesc":
     cdef cppclass XercesDOMParser:
-        void parse( sax.InputSource& )
-        dom.DOMDocument* getDocument()
+        void parse( InputSource& )
+        DOMDocument* getDocument()

File pyces/pyces.etree.pyx

-cimport util
-cimport parsers
-cimport framework
-cimport dom
+from util cimport Initialize, Terminate, XMLByte, transcode
+from parsers cimport XercesDOMParser
+from framework cimport MemBufInputSource
+from dom cimport DOMDocument, DOMNode
 from libcpp.string cimport string
 from cython.operator cimport dereference as deref
 
 cdef class _Element:
-    cdef dom.DOMNode* _c_node
+    cdef DOMNode* _c_node
     property tag:
         def __get__( self ):
-            return util.transcode( self._c_node
-                                       .getNodeName())
+            return transcode( self
+                               ._c_node
+                               .getNodeName())
     property text:
         def __get__( self ):
-            cdef dom.DOMNode* text_node = ( self._c_node
-                                                .getFirstChild())
-            return util.transcode( text_node
-                                    .getNodeValue())
+            cdef DOMNode* text_node = ( self
+                                         ._c_node
+                                         .getFirstChild())
+            return transcode( text_node
+                               .getNodeValue())
 
-cdef _element( dom.DOMNode* node ):
+cdef _element( DOMNode* node ):
     el = _Element()
     el._c_node = node
     return el
 
 def initialize():
-    util.Initialize()
+    Initialize()
 
 def terminate():
-    util.Terminate()
+    Terminate()
 
 def fromstring( s ):
-    cdef parsers.XercesDOMParser parser
+    cdef XercesDOMParser parser
     cdef string std_s = s
-    cdef framework.MemBufInputSource* yn = ( new framework
-                                                  .MemBufInputSource( <util.XMLByte*>
-                                                                      std_s
-                                                                       .c_str(),
-                                                                      std_s
-                                                                       .size(),
-                                                                      "(in memory)" ))
+    cdef MemBufInputSource* yn = ( new MemBufInputSource( <XMLByte*> std_s
+                                                                      .c_str(),
+                                                          std_s
+                                                           .size(),
+                                                          "(in memory)" ))
     parser.parse( deref( yn ))
-    cdef dom.DOMDocument* doc = parser.getDocument()
-    cdef dom.DOMNode* root = doc.getDocumentElement()
+    cdef DOMDocument* doc = parser.getDocument()
+    cdef DOMNode* root = doc.getDocumentElement()
     return _element( root )