通过API,我得到一个XML文件,我试图通过org.w3c.dom和XPath进行解析。 XML文件的一部分描述HTML内容:使用Java将XML解析为HTML org.w3c.dom
<Para>Since 2001, state and local health departments in the US have accelerated efforts to prepare for bioterrorism and other high-impact public health emergencies. These activities have been spurred by federal funding and guidance from the US Centers for Disease Control and Prevention (CDC) and the Health Resources and Services Administration (HRSA)
<CitationRef CitationID="B1">1</CitationRef>
<CitationRef CitationID="B2">2</CitationRef> . Over time, the emphasis of this guidance has expanded from bioterrorism to include "terrorism and non-terrorism events, including infectious disease, environmental and occupational related emergencies"
<CitationRef CitationID="B4">4</CitationRef> as well as pandemic influenza.
</Para>
这应该成为这样的:
<p>Since 2001, state and local health departments in the US have accelerated efforts to prepare for bioterrorism and other high-impact public health emergencies. These activities have been spurred by federal funding and guidance from the US Centers for Disease Control and Prevention (CDC) and the Health Resources and Services Administration (HRSA)
<a href="link/B1">1</a>
<a href="link/B2">3</a> . Over time, the emphasis of this guidance has expanded from bioterrorism to include "terrorism and non-terrorism events, including infectious disease, environmental and occupational related emergencies"
<a href="link/B4">4</a> as well as pandemic influenza.
</p>
我如何能做到这一点有什么建议?主要问题是检索标签并在保持其位置的同时更换它们。
这听起来像XSLT一个完美的工作,因为它是将XML输入一些其他的XML格式,或者转换成HTML语言。如果您需要关于XSLT代码的帮助,请将XSLT标签添加到您的问题中。 – 2012-04-13 09:35:17