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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.