frizi Posted February 13, 2010 Share Posted February 13, 2010 Hi! I would like to ask if someone could help me out with the issue which I'm confronting with. My goal is to cut the whole tag that might contain the ending tag that of the root tag. For example: <p id="test" class="932"> line1 <b> test of B</b> <p> ignore this paragraph</p> some text</p> // and don't finish at "this paragraph</p>" <ul id="test" class="932"><li>line1</li> <li><ul id="test2" class="done"><li> subline 1</li> <li> subline 2 </li> </ul> <li> line2</li> </ul> // and don't finish at "e 2 </li></ul>" if there is a way how to solve this, please let me know. There could be different tags with different attributes. Important is to cut out the root tag. I'm stuck in that problem and I would need a advice. Thank you! Quote Link to comment Share on other sites More sharing options...
salathe Posted February 14, 2010 Share Posted February 14, 2010 It is certainly not impossible, though if you are struggling now then perhaps it best to offer up an alternative or two instead of what will inevitably be a confusing regex solution. Personally, if at all convenient, I would use the DOM extension to completely bypass the issue you're having. You could simply target the element with the id of test and magically have the entire thing very easily. If you still want someone to rise to the 'challange' then of course, I'm sure some kind fellow will be along to accommodate such a request. Quote Link to comment Share on other sites More sharing options...
frizi Posted February 14, 2010 Author Share Posted February 14, 2010 I was thinking in similar way. I think it would be better to make a function that is checking if the first selected tag contains the root tag and if yes, take the second, or as many such tags are enclosed, closing tag. I was also thinking to use simplexml functions to work with those tags. Anyway, thanks for your help! Quote Link to comment 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.