【发布时间】:2013-12-21 11:26:09
【问题描述】:
我有一个 XML 文件,其中包含许多商店元素(请参见下面的示例),并且在商店中,它在异常元素中具有可用的日期和时间。 从这个 XML 文件中,我需要删除特定日期/日期的所有异常元素(例如,我需要在 12 月 16 日之后删除所有异常元素)。 我需要编写一个 java 程序来从特定日期删除这些异常元素并生成一个新文件。有人可以帮助我找到解决方案。
<stores>
<store>
<number>101</number>
<exception_hours>
<exception>
<date>
<![S[2013-12-16]]>
</date>
<hours>
<![S[09:00 to 22:00]]>
</hours>
</exception>
<exception>
<date>
<![S[2013-12-18]]>
</date>
<hours>
<![S[08:00 to 23:00]]>
</hours>
</exception>
<exception>
<date>
<![S[2013-12-20]]>
</date>
<hours>
<![S[08:00 to 23:00]]>
</hours>
</exception>
<exception>
<date>
<![S[2013-12-19]]>
</date>
<hours>
<![S[09:00 to 22:00]]>
</hours>
</exception>
<exception>
<date>
<![S[2013-12-15]]>
</date>
<hours>
<![S[10:00 to 19:00]]>
</hours>
</exception>
<exception>
<date>
<![S[2013-12-14]]>
</date>
<hours>
<![S[09:00 to 19:00]]>
</hours>
</exception>
</exception_hours>
</store>
<store>
.
.
.
</store>
</stores>
【问题讨论】:
-
xml 过滤器可以使用 [XSLT][1] [1] 很好地完成:stackoverflow.com/questions/4604497/xslt-processing-with-java
-
这有什么更新吗?你是怎么解决这个问题的?
标签: java