InterviewSolution
| 1. |
How Can You Assign Boolean Values To A Field In Xpath Expression ? |
|
Answer» In this example of assigning Boolean values, the XPath expression in the from clause is a call to XPath's Boolean function true, and the specified approved field is set to true. The function FALSE is also available. The XPath SPECIFICATION recommends that you use the "true()" and "false()" functions as a method for returning Boolean constant values. If you instead use "boolean(true)" or "boolean(false)", the true or false INSIDE the Boolean function is interpreted as a relative element step, and not as any true or false constant. This means it attempts to select a child node NAMED true under the current XPath context node. In most cases, the true node does not exist. Therefore, an empty result node set is returned and the boolean() function in XPath 1.0 converts an empty node set into a false result. This result can be potentially confusing. In this example of assigning Boolean values, the XPath expression in the from clause is a call to XPath's Boolean function true, and the specified approved field is set to true. The function false is also available. The XPath specification recommends that you use the "true()" and "false()" functions as a method for returning Boolean constant values. If you instead use "boolean(true)" or "boolean(false)", the true or false inside the Boolean function is interpreted as a relative element step, and not as any true or false constant. This means it attempts to select a child node named true under the current XPath context node. In most cases, the true node does not exist. Therefore, an empty result node set is returned and the boolean() function in XPath 1.0 converts an empty node set into a false result. This result can be potentially confusing. |
|