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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -