xml minidom访问自由文本

时间:2018-10-29 13:28:46

标签: python minidom

我有以下类型的XML文件,带有自由文本(点)。我该如何获取这些自由文本(如(,)、. In:在标签之间)?

<bibl>
    <author>Gooday GW</author> 
    (
    <date>1994</date>
    ) 
    <title level="a">Physiology of microbial degradation of chitin and chitosan</title>
    . In: 
    <title level="m">Biochemistry of microbial degradation</title>
    . 
    <publisher>Springer</publisher>
    ,
    <pubPlace>Dordrecht</pubPlace>, 
    pp <biblScope unit="page">279–312</biblScope>
</bibl>

现在,我可以使用以下代码访问标记的数据:

mydoc = minidom.parse('./473_book.xml')
bibls = mydoc.getElementsByTagName('bibl')
for bibl in bibls: 
    author = bibl.getElementsByTagName('author')
    date=bibl.getElementsByTagName('date')
    ....

0 个答案:

没有答案