【发布时间】:2019-09-29 15:35:07
【问题描述】:
我正在解析一个 3gb xml 文件,该文件在 python 中具有复杂的 xml.sax 结构。 当 3gb xml 文件包含特殊字符如“
我想知道如何同时用“
我试图通过正则表达式来捕捉它的内容,但这对我来说并不容易。
<DC.Title><main>Characteristics of the interaction mechanism between tannic <acid> and sodium caseinate using multispectroscopic and thermodynamics methods</main>
</DC.Title>
从中,我想提取以下内容。
Characteristics of the interaction mechanism between tannic <acid> and sodium caseinate using multispectroscopic and thermodynamics methods
但由于'
我尝试使用 ContentHandler 类中的方法。
使用正则表达式,替换特殊字符很难,python中的xml.sax无法处理这个问题。
我想我应该交换每个特殊字符,例如“
============================================== 添加在下面(实际xml)
<NDSL_Articles>
<Article><DC.Identifier><controlNumber>73113660</controlNumber>
<controlNumber.source.BL>RN602387147</controlNumber.source.BL><controlNumber.source>JAKO201857968658354</controlNumber.source>
<journal scheme="URL">http://society.kisti.re.kr/journal/kj_view.jsp?kj=HJTODO&soc=etri&ndsl=y</journal>
<article scheme="URL">http://society.kisti.re.kr/journal/view.jsp?soc=etri&kj=HJTODO&py=2018&vol=40&iss=2&sp=283&ndsl=y</article>
<article.source scheme="KOI">KISTI1.1003/JNL.JAKO201857968658354</article.source>
<article.source scheme="URL">http://koix.kisti.re.kr/KISTI1.1003/JNL.JAKO201857968658354</article.source>
<article scheme="DOI">http://dx.doi.org/10.4218/etrij.15.0114.0065</article>
<article.source scheme="ACMS_CN2">etri/HJTODO_2018_v40n2_283</article.source>
<paper scheme="ISSN">1225-6463</paper>
<publicationID.source>HJTODO</publicationID.source>
</DC.Identifier>
<DC.Relation><isPartOf>
<title>ETRI Journal</title>
<volume>v.40 no.2</volume>
<sourcePage>283-283</sourcePage>
<startPage>283</startPage>
<lastPage>283</lastPage>
<type>Journal</type>
</isPartOf></DC.Relation>
<DC.Description><reference.count>0</reference.count></DC.Description>
<DC.Format><Pages>1</Pages></DC.Format>
<DC.Language><text scheme="USMARC">eng</text></DC.Language>
<DC.Creator><personal><main>Hong, Kang Woon</main><affiliation>Department of Information and Communications Engineering, KAIST, Broadcasting & Telecommunications Media Research Laboratory, ETRI</affiliation><email>kangwoon@kaist.ac.kr, gwhong@etri.re.kr</email></personal><personal><main>Ryu, Won</main><affiliation>Broadcasting & Telecommunications Media Research Laboratory, ETRI</affiliation></personal></DC.Creator>
<DC.Title><main>Corrigendum</main>
</DC.Title>
<DC.Publisher><main>Electronics and Telecommunications Research Institute</main><alternative>한국전자통신연구원</alternative></DC.Publisher>
<DC.Date><created scheme="ISO 8601">2018-04-01</created></DC.Date>
<DC.Type>Article</DC.Type>
<NDSL.Usage scheme="freetext">eletronic</NDSL.Usage>
<NDSL.Cataloging> <instituion scheme="Internal">BL</instituion> <source.version>KISTI XML기반의 학술정보 및 협회기술정보 가공 지침서 v.1.0</source.version> <date scheme="ISO 8601">2015-09-25T13:48:09</date> <name>BL</name> <instituion.lastUpdate scheme="Internal">NDSL 센터</instituion.lastUpdate> <date.lastUpdate scheme="ISO 8601">2018-07-12T11:17:45</date.lastUpdate> <name.lastUpdate>김순영</name.lastUpdate> </NDSL.Cataloging>
</Article>
<DC.DOI>
<doi>http://dx.doi.org/10.4218/etrij.15.0114.0065</doi>
</DC.DOI>
</NDSL_Articles>
【问题讨论】:
-
请发布您的相关实际代码并确定报告的具体错误。
-
问题是没有
</acid>结束标签,导致输入格式不正确。 -
我的意思是 '' 不是标签只是特殊字符!