Jump to content

XPath Ignore Child


codefossa

Recommended Posts

So I'm stuck on an issue while parsing a forum, I want to ignore the quotes and only read the message from the posted user. So ..

 

Imagine I have this HTML loaded.

<div class="main">
	<div class="quote">
		Some stuff written here ..
	</div>
	More written here and a <b>bold word</b> or two.
</div>
So, what I want to return is:

More written here and a bold word or two.
Which is returned when I evaluate the path, but it also returns what's in the quote and I ain't sure how to ignore that. Using /text() will ignore the bolded words in this example.

 

Thanks for any help.

Link to comment
https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/
Share on other sites

Thanks, but the problem is I'm collecting all of the posts and users on the page. When I select /node() it will split up the posts and I really have no way to determine which post goes with which user.

 

An alternative would be if it were possible to return the HTML and then I could remove the quotes with PHP. I ain't sure if you can return plain HTML though.

Link to comment
https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/#findComment-1457291
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.