XML Functions 2256 Error handling.   For both  ExtractValue()  and  UpdateXML() , the XPath locator used must be valid and the XML to be searched must consist of elements which are properly nested and closed. If the locator is invalid, an error is generated: If  xml_frag  does not consist of elements which are properly nested and closed,  NULL  is returned and a warning is generated, as shown in this example: mysql>  SELECT ExtractValue(’<a>c</a><b/>’, ’/&a’); ERROR 1105 (HY000): XPATH syntax error: ’&a’ mysql>  SELECT ExtractValue(’<a>c</a><b’, ’//a’); +-----------------------------------+ | ExtractValue(’<a>c</a><b’, ’//a’) | +-----------------------------------+ | NULL | +-----------------------------------+ 1 row in set, 1 warning (0.00 sec) mysql>  SHOW WARNINGS\G *************************** 1. row *************************** Level: Warning Code: 1525 Message: Incorrect XML value: ’parse error at line 1 pos 11: END-OF-INPUT unexpected (’>’ wanted)’ 1 row in set (0.00 sec) mysql>  SELECT ExtractValue(’<a>c</a><b/>’, ’//a’); +-------------------------------------+ | ExtractValue(’<a>c</a><b/>’, ’//a’) | +-------------------------------------+ | c | +-------------------------------------+ 1 row in set (0.00 sec) <?php $file = "users.xml"; $login = $POST["login"]; $password = $POST["password"]; A PHP application employing XPath might handle the login process like this: SELECT id FROM users WHERE login=’neapolitan’ AND password=’1c3cr34m’; This is the XPath equivalent of an SQL statement like this one: //user[login/text()=’neapolitan’ and password/text()=’1c3cr34m’]/attribute::id A common scenario in which this can happen is the case of application which handles authorization by matching the combination of a login name and password with those found in an XML file, using an XPath expression like this one: XPath Injection.  code injection  occurs when malicious code is introduced into the system to gain unauthorized access to privileges and data. It is based on exploiting assumptions made by developers about the type and content of data input from users. XPath is no exception in this regard. The replacement XML used as the third argument to  UpdateXML()  is  not  checked to determine whether it consists solely of elements which are properly nested and closed. Important