Search code examples
phpxpathsimplexml

Unfinished string litteral simplexml


It got this line using xpath with error :

A PHP Error was encountered

Severity: Warning

Message: SimpleXMLElement::xpath(): Unfinished literal

Filename: requete_oracle/Accueil.php

Line Number: 345

This is my line :

$string = $sharedStrings->xpath("//*[local-name()='t' and .= '".(string)$data."']");    

local-name is because of namespace problems.

It don't know where is the problem..

Thank you for help !


Solution

  • Here is the solution for me :

    $string = $sharedStrings->xpath('//*[local-name() = "t" and .= "{$data}"]');