Closed pamoller closed 2 years ago
Transforming JSON documents to XML document to use with XPath causes a loss of information, cause the string operator translates true and null to ''
string
true
null
''
$subNode->nodeValue = htmlspecialchars((string)$value);
So boolean values can't be found by an expression like:
$I->seeResponseJsonXpathEvaluatesTo("//boolean[text() = 'true']");
Using a more elaborated transformation, https://tqdev.com/2017-converting-json-to-xml-in-javascript-and-php, keeps all informations:
{"boolean":true, "number": -1.2780E+2, "null": null, "string": "i'am a sentence"}
transforms to now
<root> <boolean type="boolean">true</boolean> <number type ="number">-127.8</number> <null type="null"></null> <string type="string">i'am a sentence</string> </root>
so see now: JsonArrayTest.php
I hope, this fits the needs :)
Released as 3.3.0
Transforming JSON documents to XML document to use with XPath causes a loss of information, cause the
string
operator translatestrue
andnull
to''
So boolean values can't be found by an expression like:
Using a more elaborated transformation, https://tqdev.com/2017-converting-json-to-xml-in-javascript-and-php, keeps all informations:
transforms to now
so see now: JsonArrayTest.php