示例#1
0
文件: elemtree.py 项目: xkenneth/gxml
    def parse(self,file_object):
        """Parse a file object."""
        t = et.parse(file_object)

        self.node = t.getroot()
        
        assemble(self,self.__class__)

        return self
示例#2
0
文件: minidom.py 项目: xkenneth/gxml
    def parse(self,file_object):
        """Parse a file object."""
        
        #parse it
        self.node = xml.dom.minidom.parse(file_object).childNodes[0]

        return assemble(self,self.__class__)
示例#3
0
文件: elemtree.py 项目: xkenneth/gxml
def from_string(xml_str):
    t = elemtree()
    return assemble(t,elemtree)
示例#4
0
文件: minidom.py 项目: xkenneth/gxml
 def from_string(self,xml_str):
     """Parse a string."""
     self.node = xml.dom.minidom.parseString(xml_str).childNodes[0]
     
     return assemble(self,self.__class__)