Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - string value of every element [Thread Next] Re: string value of every elementTo: NULL Date: 5/4/2009 2:08:00 AM Phantom wrote: > Simple question that's driving me freakin mad. Hard to answer without seeing your code -- are you working with XPath, or with the DOM, or with one of the other APIs/tools? Are you sure that whatever being returned doesn't need to be iterated over to retrieve the rest of the content? In XPath, the string value of the fruits element is normally going to be all text contained within it -- which will include the newlines: " apple banana pear " If you had asked for the string value of /fruits/fruit, you would get "apple", since the string value of a multiple-node result is the string value of the first match. You'd need to iterate through the results to gather the other values, and of course concatenating them into a string would be your responsibility. If you're using the simple DOM operations, elements don't have a string value; you must navigate the tree and gather the values. The DOM's XPath support, if present in your DOM, has an operation which will do the gather-and-concatenate operation -- but again, it's going to include the newlines. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
