简体   繁体   中英

How does XPath “evaluate” method work?

I want to understand a difference between execution of evaluation when-

  1. Document object's setNameSpaceAware and isValidating is set to true - In this case, I understand that if my XML uses a namespace, then I need to set NameSpaceContext. If I do not set NameSpaceContext, how does evaluate method work/ handle this condition?
  2. Document object's setNameSpaceAware and isValidating is set to false - What happens exactly if these 2 are set to false?

(This question could be linked to an issue mentioned in this question.)

XPath is not defined except on namespace-aware source documents. So the simple answer is, anything might happen depending on the implementation.

By constrast, XPath should work regardless of the setting of isValidating, and in nearly all cases should produce the same results. An exception might be the use of the id() function, which depends on ID attributes being recognised.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM