Chinaunix

标题: openoffice odt文件解压成xml文件,项目编号以及文本的提取问题 [打印本页]

作者: feiying00917    时间: 2014-07-02 12:14
标题: openoffice odt文件解压成xml文件,项目编号以及文本的提取问题
我用openoffice创建的一个odt文档,我先解压成xml文件,可是在content.xml里面找不到项目编号了,附件里是odt文件和解压出来的xml文件. 还有如何提取出正文文件,因为content.xml只有2行,还有许多格式的标记符,比如在content.xml提取出3.6.1 的内容"If someone loves a flower, of which just one single blossom grows in all the millions and millions of stars, it is enough to make him happy just to look at the stars. He can say to himself, "Somewhere, my flower is there…"。  求高手帮忙,万分感谢!!!

test1.png (20.49 KB, 下载次数: 16)

test1.png

test2.png (47.44 KB, 下载次数: 18)

test2.png

example.7z

16.62 KB, 下载次数: 1


作者: huang6894    时间: 2014-07-02 12:26
使用<[^>]/>就是啦
作者: feiying00917    时间: 2014-07-02 13:33
求Perl代码回复 2# huang6894


   
作者: 104359176    时间: 2014-07-02 21:20
本帖最后由 104359176 于 2014-07-02 21:21 编辑

用Perl 处理 XML 很蛋疼,不如用 Ruby 或 Python 做个通用的 XML 解析,然后提取指定 tag 的程序。
作者: feiying00917    时间: 2014-07-03 09:35
只会Perl的啊回复 4# 104359176


   
作者: 104359176    时间: 2014-07-04 08:27
回复 5# feiying00917


    连 Perl 都能学会,Ruby 和 Python 更不在话下。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2