py::qo::xmlutil Namespace Reference


Functions

def text_from_string
def create_document
def readText
def to_string
def bool_from_string


Function Documentation

def py::qo::xmlutil::bool_from_string (   data  ) 

00055                              :
00056         if data in [ "1" ] :
00057                 return True
00058         elif data in [ "0" ] :
00059                 return False
00060         raise ValueError(data)
00061 
00062 

def py::qo::xmlutil::create_document (   root,
  ns = "qo",
  nsurl = "http://qomics.inzenet.org/XML" 
)

00028                                                 ://qomics.inzenet.org/XML" ) :
00029         return xml.dom.minidom.parseString("""<?xml version="1.0"?><%(ns)s:%(root)s xmlns:%(ns)s="%(nsurl)s"/>""" % {
00030                         "ns" : ns,
00031                         "nsurl" : nsurl,
00032                         "root" : root,
00033                 })
00034 

def py::qo::xmlutil::readText (   node  ) 

00035                      :
00036         ret = ""
00037         e = node.firstChild
00038         while e is not None :
00039                 if e.nodeType in [ xml.dom.Node.TEXT_NODE, xml.dom.Node.CDATA_SECTION_NODE ] :
00040                         ret += e.nodeValue
00041                 e = e.nextSibling
00042         return ret
00043 
def to_string( data ) :

def py::qo::xmlutil::text_from_string (   s  ) 

Returns a well-formed string for xml attribute
00022                           :
00023         """
00024         Returns a well-formed string for xml attribute
00025         """
00026         return s.replace('"','&quote;').replace('&','&amp;')
00027 
def create_document( root,  ns="qo", nsurl="http://qomics.inzenet.org/XML" ) :

def py::qo::xmlutil::to_string (   data  ) 

00044                       :
00045         if data is None :
00046                 return ""
00047         else :
00048                 if isinstance(data, bool) :
00049                         if data :
00050                                 return "1"
00051                         else :
00052                                 return "0"
00053         return str(data)
00054 
def bool_from_string( data ) :


Generated on Tue Oct 9 20:40:33 2007 for Qomics by  doxygen 1.5.3