Parsing XML Data
Before you can access the XML data with the JSTL XML actions, the
imported document must be parsed and converted to a data structure
the actions can read. That’s what the
<x:parse>
action does (see Table 15-3).
|
Attribute name |
Java type |
Dynamic value accepted |
Description |
doc |
|
Yes |
Mandatory, unless specified as the body. The XML document to parse. |
systemId |
String |
Yes |
Optional. The system identifier for the XML document. |
filter |
org.xml.sax.XMLFilter |
Yes |
Optional. An |
var |
String |
No |
Optional. The name of the variable to hold the result as an implementation-dependent type. |
scope |
String |
No |
Optional. The scope for the variable, one of |
varDom |
String |
No |
Optional. The name of the variable to hold the result as a
|
scopeDom |
String |
No |
Optional. The scope for the DOM variable, one of
|
The XML document to parse can be specified as the body or as a
String or Reader variable. In
Example 15-3, I use the Reader
exposed by the <c:import> action to get the
best performance. A base URI for interpretation of relative URIs in
the document can be specified by the systemId
attribute, the same way as for the
<x:transform> action.
The parse result can be saved either as an implementation-dependent data structure ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access