开发者

xpath - how to select every character between an opening and closing tag <example> </example>

Hello i am programming in Java and..

I have an xml file and I am thinking of using xpath to grab every character between the elements in the code below: I was wondering how would this be done in xpath? I do not want to parse it because between the tags are lots of other tags and attributes and text..

<book>
 <book element 1>
  ........
 </book element 1>

 <book element 2>
  <D开发者_JS百科ATA>.............
  ..............
  ...........
  </DATA>
 </book element 2>
</book>


So, you want to parse the document to the extent that you locate the DATA start and end tags, but you then want access to the unparsed text between these tags. I can't think of an approach that will give you that. You can always reconstitute the markup from the parsed content, of course, but that's not what you asked for.

So, if it's not possible to do what you are trying to do, that might be a good indication that you are tackling your problem the wrong way. To advise you on that, we need to know what your problem is.


Can't you just use <xsl:copy-of select="books/books"/>?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜