tags:

views:

58

answers:

1

Good day, colleagues!

Tell me please, how to make a dynamic xpath-parsing:

for example, instead of writing

$domXPath->query('//*[(@id = "article-id-18")]');

-> write something like that

$domXPath->query('//*[(@id = "article-id-*")]');

, because in my case, the site's script generate (every time) a new id for block, that contains article's text?

So question, is above.

+4  A: 

Try

$domXPath->query('//*[starts-with(@id, "article-id-")]');
S.Mark
I've just tested your suggestion, and in all cases gotten only: bool(false);very strange
Ferol
I wrote:$domNodeList = $domXPath->query('//*[starts-with(@id, "article-id-")]');echo var_dump($domNodeList);exit;
Ferol
yippee!!! now works fine!)) mega-bomb! Thanks man! It was my mistake))ps: where I can find more information about domxpath expressions?
Ferol
Hi @Ferol, I use this one - http://www.zvon.org/xxl/XPathTutorial/General/examples.html
S.Mark
cool, I'm reading!
Ferol
Thanks again, Mark!
Ferol
You're welcome @Ferol
S.Mark