[Dev OpenGP] [33] Begin ef xml abstraction

[ Thread Index | Date Index | More opengp.tuxfamily.org/development Archives ]


Revision: 33
Author:   nicolaf
Date:     2009-03-13 11:24:52 +0100 (Fri, 13 Mar 2009)

Log Message:
-----------
Begin ef xml abstraction

Added Paths:
-----------
    trunk/src/DomElementMethods/
    trunk/src/DomElementMethods/ElementMethods.py
    trunk/src/DomElementMethods/__init__.py
    trunk/src/DomElementMethods-test.py


Added: trunk/src/DomElementMethods/ElementMethods.py
===================================================================
--- trunk/src/DomElementMethods/ElementMethods.py	                        (rev 0)
+++ trunk/src/DomElementMethods/ElementMethods.py	2009-03-13 10:24:52 UTC (rev 33)
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*
+
+from xml.dom.minidom import *
+ATTR_BLOCK="block"
+
+def getAttributes(self):
+	pass
+
+def getBlocking(self):
+	"""
+		A more convenient way to access
+	"""
+	print "get"
+	if (not self.hasAttribute(ATTR_BLOCK)):
+		return False
+	else:
+		return bool(self.getAttribute(ATTR_BLOCK))
+
+def setBlocking(self,blocking):
+	print "set"
+	self.setAttribute(ATTR_BLOCK,blocking)
+
+def getText(self):
+	return self.__text
+
+def setText(self,text):
+	self.__text=text

Added: trunk/src/DomElementMethods/__init__.py
===================================================================
--- trunk/src/DomElementMethods/__init__.py	                        (rev 0)
+++ trunk/src/DomElementMethods/__init__.py	2009-03-13 10:24:52 UTC (rev 33)
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*
+from xml.dom.minidom import * 
+from ElementMethods import *
+
+Element.getAttributes=getAttributes
+
+Element.getBlocking=getBlocking
+Element.setBlocking=setBlocking
+
+Element.setText=setText
+Element.getText=getText

Added: trunk/src/DomElementMethods-test.py
===================================================================
--- trunk/src/DomElementMethods-test.py	                        (rev 0)
+++ trunk/src/DomElementMethods-test.py	2009-03-13 10:24:52 UTC (rev 33)
@@ -0,0 +1,10 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*
+from xml.dom.minidom import *
+import DomElementMethods
+
+obj = Element("test")
+print obj.getBlocking()  # get
+obj.setBlocking(True)    # set
+print obj.getBlocking()  # get
+


Property changes on: trunk/src/DomElementMethods-test.py
___________________________________________________________________
Name: svn:executable
   + *


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/