We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When find for > span for example, throw a error Expected selector, but " at 0> found.
> span
Expected selector, but " at 0> found.
In the code above, first echo show real 29.30 nodes fine, but second one need to return just 29.30
real 29.30 nodes
29.30
$find = (new \voku\helper\HtmlDomParser())->loadHtml(<<<EOD <html> <body> <div class="card-action-item"></div> <div class="card-action-item"> real <span>29.30</span> <span> nodes</span> </div> </body> </html> EOD); $find = $find->find(".card-action-item:nth-child(2)", 0); $all = $find->text; echo $all . "\n"; $find = $find->find("> span"); $just_value = $find->text; echo $just_value . "\n";
I have tested on another languages, and this may be a valid selector. am I doing something wrong?
The text was updated successfully, but these errors were encountered:
As we can use xpath to create a selector too, enable axes can help (#103)
with this change, we can use something like this
$find = (new \voku\helper\HtmlDomParser())->loadHtml(<<<EOD <html> <body> <div class="card-action-item"></div> <div class="card-action-item"> real <span>29.30</span> <span> nodes</span> </div> </body> </html> EOD); $find = $find->find(".card-action-item:nth-child(2)", 0); $all = $find->text; echo $all . "\n"; // print real 29.30 nodes $find = $find->find("child::span"); $just_value = $find->text; echo $just_value . "\n"; // print 29.30
if @voku accept the idea, i can implement another ones https://www.w3schools.com/xml/xpath_axes.asp
Sorry, something went wrong.
No branches or pull requests
What is this feature about (expected vs actual behaviour)?
When find for
> span
for example, throw a errorExpected selector, but " at 0> found.
In the code above, first echo show
real 29.30 nodes
fine, but second one need to return just29.30
How can I reproduce it?
Any additional information?
I have tested on another languages, and this may be a valid selector. am I doing something wrong?
The text was updated successfully, but these errors were encountered: