php - Building a DomNode from an xpath definition -
is there way in php create domelement, added domdocument later, xpath definition.
lets say,we have
$xpath = 'a:ul[@class="something]';
what want in result, domelement containing :
<a:ul class="something"/>
or, if :
$xpath = 'a'; //result <a/>
another example :
$xpath = 'a:ul[@class="something , @id=abc]'; //result <a:ul class="something" id="abc"/>
of course here way, not easy. have define xpath language , parser it.
here lot of features in xpath extremely difficult or impossible expand dom structure. simple example //*
- matches element node in document, has no tag name use create node.
so first have define own language uses same syntax xpath, lot less features.
then create parser , last use dom methods create xml nodes.
Comments
Post a Comment