summaryrefslogtreecommitdiff
path: root/pyeletree.py
blob: 0af240f2932585b6c5ffdf73b9b4c19e0a602a3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /usr/bin/python2

import sys
import xml.etree.ElementTree as et

def process(f):
    r = et.parse(f).getroot()
    tg = r.findall("./front/article-meta/title-group")
    at = tg[0].find("article-title")
    if at is not None:
        print "article-title:", "".join(at.itertext()).encode('utf-8')

for xmlf in sys.argv[1:]:
    f = open(xmlf, "rb")
    process(f)
    f.close()