Answer the question
In order to leave comments, you need to log in
How to find nested DOM element by attribute value in php?
There is a view template:
<section name="myname1">
...
<div name="myname2">
...
<p name="myname3">
...
</p>
...
</div>
...
</section>
<div name="myname4">
...
<div name="myname5">
...
</div>
...
</div>
Answer the question
In order to leave comments, you need to log in
Problem solved:
Tag name: table, can be replaced with ([a-z0-9]+), then all tags will be searched. The main thing then is to substitute this group in the appropriate positions in the regular expression.
The name and value of the attribute ("name", "table01") can be dynamically substituted (in my case, they are set by php variables)
All the problems I have described with large nesting parsing have been resolved.
I hope it will be useful to someone :)
If you can search on the client ( + jquery), then you can use this selector:
If you need to rake in php , here is some kind of parser - PHP Simple HTML DOM Parser and by analogy with the selector above
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question