Skip to content

Xpath compatibility#87

Closed
pamoller wants to merge 16 commits into
Codeception:masterfrom
pamoller:xpath_compatibility
Closed

Xpath compatibility#87
pamoller wants to merge 16 commits into
Codeception:masterfrom
pamoller:xpath_compatibility

Conversation

@pamoller
Copy link
Copy Markdown
Contributor

Transforming JSON documents to XML document to use with XPath causes a loss of information, cause the string operator translates true and null to ''

 $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

@Naktibalda
Copy link
Copy Markdown
Member

Please rebase your branch on master branch of this repository.

@Naktibalda
Copy link
Copy Markdown
Member

It seems that you forgot to fetch

@pamoller
Copy link
Copy Markdown
Contributor Author

So everything ok, wright now?

@Naktibalda
Copy link
Copy Markdown
Member

16 commits is not ok, it shows commits from your previous pull request.
It would probably be better start a new branch based on master (or git reset --hard) and cherry-pick commits from this branch,

@pamoller
Copy link
Copy Markdown
Contributor Author

I created an new pull request, hopes that fit the needs :)

@Naktibalda Naktibalda closed this Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants