codefossa Posted November 6, 2013 Share Posted November 6, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/ Share on other sites More sharing options...
requinix Posted November 6, 2013 Share Posted November 6, 2013 I'll throw out /html/body/div/node()[not(@class='quote')]but it depends what you're doing now. Quote Link to comment https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/#findComment-1457287 Share on other sites More sharing options...
codefossa Posted November 7, 2013 Author Share Posted November 7, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/#findComment-1457291 Share on other sites More sharing options...
requinix Posted November 7, 2013 Share Posted November 7, 2013 Then what's the rest of the HTML? Sounds like So, what I want to return is: More written here and a bold word or two. isn't the full story. And what's your code? That'll be easier to understand than a description. Quote Link to comment https://forums.phpfreaks.com/topic/283667-xpath-ignore-child/#findComment-1457294 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.