[Kimchi-devel] [PATCH 2/3] Use lxml.etree on gen-index.py script instead of libxml2

Aline Manera alinefm at linux.vnet.ibm.com
Wed Oct 29 16:09:13 UTC 2014


That way we remove all the occurrences of libxml2 on Kimchi code and
then we don't need to depend on libxml2-python package anymore.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 ui/pages/help/gen-index.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/ui/pages/help/gen-index.py b/ui/pages/help/gen-index.py
index cf7c5d7..ec7bdd2 100755
--- a/ui/pages/help/gen-index.py
+++ b/ui/pages/help/gen-index.py
@@ -18,7 +18,7 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
-import libxml2
+import lxml.etree as ET
 import sys
 
 
@@ -44,14 +44,13 @@ def main():
     input_files = sys.argv[1:]
 
     pages = {}
+
     for f in sorted(input_files):
         with open(f) as fd:
             xml = fd.read()
-            doc = libxml2.parseDoc(xml)
-            node = doc.xpathEval('/cshelp/title')[0]
-            name = node.children.content
-            pages[f.replace('.dita', '.html')] = name
-            doc.freeDoc()
+            doc = ET.fromstring(xml)
+            name = doc.xpath('./title')[0].text
+            pages[f.replace('.dita', '.html')] = name.encode('utf-8')
 
     print HTML_HEAD
     for page, name in pages.iteritems():
-- 
1.9.3




More information about the Kimchi-devel mailing list