我决定使用XFormat节点从使用PHP的API调用中获取我的JSON POSTFIELDS。下面是 从JSON字符串转化为为XMLDocument的XML数据的结果:Flowgear中未定义名称空间前缀'salesValue'
<root>
<salesValue>5000</salesValue>
<authorId>2</authorId>
</root>
从https://developers.flowgear.net/kb/Node:XPath_Match读我想出了下面的XPath 抓住这些价值观很感兴趣,并注入他们对我的SQL查询:
- salesValue:根/ salesValue
- AUTHORID:根/ AUTHORID
我已经选择XML作为我的转义价值,该属性不知道它应该是哪一个。我得到的错误是:
(XFormat 1.0.0.1):名称空间前缀'salesValue'未定义。
我想这个问题与我如何格式化我的XPath,试图获取这些值。在我XFormat节点表达属性的SQL查询如下所示:
SELECT `Book`.`id` , `Book`.`name` , `Book`.`isbn` , `Book`.`quantity_in_stock` , `Book`.`price` , (`Book`.`quantity_in_stock` * `Book`.`price`) AS `sales`,
concat(`Author`.`name`, ' ', `Author`.`surname`) AS `author` FROM `books` AS `Book` LEFT JOIN authors AS `Author` ON (`Book`.`author_id` = `Author`.`id`)
WHERE (`Book`.`quantity_in_stock` * `Book`.`price`) > {salesValue} AND `Book`.`author_id` = " {authorId}"
我应该有这些值在查询注入我能够继续前进。下面是我的脚本使用通过API调用的工作流程:
try{
$results = invokeFlowgear("https://domain.flowgear.io/authorbooksaleslist", "login", "passwrd", 30,
array(
'salesValue' => 5000.00,
'authorId' => 2
));
var_dump($results);
}catch(Exception $exc){ print $exc->getMessage(); }
预先感谢您...