JSP JSTL < x: parse > tag: parses the specified XML content


XML Document to parse

Example

<%@taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml"%>
  <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <c:import url="bookInfo.xml" var="xmlFile" charEncoding="gbk"/>
    <x:parse var="bookInfo" doc="${xmlFile}"></x:parse>
    编号:<x:out select="$bookInfo/books/book/id/@value"/><br>
    书名:<x:out select="$bookInfo/books/book/name/@value"/><br>
    出版社:<x:out select="$bookInfo/books/book/publish/@value"/>
<?xml version="1.0" encoding="gbk"?>
<books>
  <book>
    <id value="1"/>
    <name value="Java开发宝典"/>
    <author value="C语言中文网"/>
    <publish value="机械工业出版社"/>
  </book>
</books>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>