Commit a2d5f88a authored by Nicolas Delaby's avatar Nicolas Delaby

replace libxml2 library by lxml

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 554d70eb
# -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2006-2007 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2006-2007 Nexedi SA and Contributors. All Rights Reserved.
...@@ -26,20 +27,20 @@ ...@@ -26,20 +27,20 @@
############################################################################## ##############################################################################
from DateTime import DateTime from DateTime import DateTime
import urllib2 import urllib2
import libxml2 from lxml import etree
import re import re
from zLOG import LOG from zLOG import LOG
def getObjectStringList(xml_string, element_to_find = 'object'): def getObjectStringList(xml_string, element_to_find='object'):
""" """
this function splits an ERP5 XML string into object this function splits an ERP5 XML string into object
string list, each object string is converted string list, each object string is converted
into utf-8 encoding and html entities are into utf-8 encoding and html entities are
translated into corresponding unicode code translated into corresponding unicode code
""" """
rss_doc = libxml2.parseDoc(xml_string) rss_doc = etree.fromstring(xml_string)
return ['%s' % node for node in rss_doc.xpathEval('//%s' % element_to_find)] return [etree.tostring(node) for node in rss_doc.xpath('//%s' % element_to_find)]
def setTextContent(self): def setTextContent(self):
""" """
......
203 205
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment