Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-10-2008
Member
 
Join Date: Aug 2006
Posts: 227
Problem with inline elements in XPath

Hello everybody,

I have a question concerning XPath expressions. Consider this XML
snippet:

<foo title="an attempt">
<ul>
<li>This works fine</li>
<li>Before the inline element <em>Inside the inline element</em> after
the inline element</li>
<li>This also works fine</li>
</ul>
</foo>

In order to reach the first list element, I would use the XPath expression "/foo/ul/li[1]", which works fine. (I get the first list element with "This works fine", as expected.)

However, I need an XPath expression that returns the second list
element in three "portions":
- "Before the inline element "
- "Inside the inline element"
- " after the inline element"

I can get the inside of the inline element with "/foo/ul/li/em", but I have no idea how to get the surrounding strings. Any ideas?
Reply With Quote
  #2  
Old 25-10-2008
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: Problem with inline elements in XPath

In article <eb4e5dda-302b-44cd-ba4e->,

This will return the text descendants of the <li> elements:

/foo/ul/li//text()

Please remember to mention me / in tapes you leave behind.
Reply With Quote
  #3  
Old 25-10-2008
Member
 
Join Date: Aug 2006
Posts: 227
Re: Problem with inline elements in XPath

hi Reegan, Hello Richard,
Thank you very much, that seems to work!
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem with inline elements in XPath"
Thread Thread Starter Forum Replies Last Post
How to Manipulate XML with XPath in VBScript Zavier Software Development 4 18-04-2010 03:05 AM
What are the XForms and XPath? Nathen Software Development 5 03-03-2010 05:35 AM
What is XPath Eleeazar Software Development 3 21-11-2009 05:30 AM
Problem with static and inline in C++ Sujit15 Software Development 3 06-05-2009 01:15 PM
Photoshop Elements and Premiere Elements go to version 7.0 Killen Customize Desktop 2 29-08-2008 01:17 PM


All times are GMT +5.5. The time now is 11:23 PM.