0
/web-app/filter/filter-class[text()="com.zide.AppFilter"]/following-sibling::init-param/param-name[text()="development.mode"]/following-sibling::param-value
要替换的节点。如何改善这个xpath表达式?
<web-app>
<!--
<welcome-file-list>
<welcome-file>login/index.jsp</welcome-file>
</welcome-file-list>
-->
<filter>
<filter-name>Zide APP Filter</filter-name>
<filter-class>com.zide.AppFilter</filter-class>
<init-param>
<param-name>config-file</param-name>
<param-value>*.jsp,*.js</param-value>
</init-param>
<init-param>
<param-name>development.mode</param-name>
<param-value>true</param-value>
</init-param>
</filter>
</webapp>
XML文件大小 - 100kb。
没有在一个文件中的行 - 2600
的时间来执行表达式取为〜213毫秒来执行。
有什么办法可以在java中优化这个表达式。
你是怎么测量的?你确定你没有包括解析XML文件和编译XPath表达式吗? – millimoose 2012-07-31 17:39:16
@millimoose 它包括解析和编译时间。 – kannanrbk 2012-08-01 05:27:09
你能提供给我们测试文件吗? – 2012-08-01 06:47:47