Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

tag

tag

JSP Standard Label LibraryJSP Standard Tag Library

The tag is used to parse XML data in an attribute or in the tag's body.

Syntax format





property

The tag has the following attributes:

property Description Whether it is required Default value
var The variable that contains the parsed XML data No None
xml The text content of the document to parse (String or Reader) No Body
systemId The system identifier URI used to resolve the document No None
filter The filter applied to the source document No None
doc The XML document to parse No Page
scope The scope of the var attribute No Page
varDom The variable that contains the parsed XML data No Page
scopeDom The scope of the varDom attribute No Page

Example Demonstration

The following example shows us how to parse an XML document:

The code of the books.xml file is as follows:







  Padam History

  ZARA

  100





  Great Mistry

  NUHA

  2000





The code of the main.jsp file is as follows:



<%@ page language="java" contentType="text/html; charset=UTF-8"

    pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>







  JSTL x:parse 标签





Books Info:

The title of the first book is:
The price of the second book:

The running result is as follows:



BOOKS INFO:

The title of the first book is:Padam History 

The price of the second book: 2000


JSP Standard Label LibraryJSP Standard Tag Library