[Freemarker XML Processing] XPATH里必须包含namespace,即使表达式只与默认 namespace有关

原文这样说的:

===================================================================

Unfortunately, XPath does not support this idea of a default namespace. Thus, in XPath expressions, element names without prefixes always select the elements that does not belong to any XML namespace. However, to access elements in the default namespace you can directly use prefix D, for example:

doc["D:book/D:chapter[title='Ch1']"].

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.