Name

<x:parse>

Synopsis

The <x:parse> action parses an XML document and saves the result either as a standard org.w3c.dom.Document object or as an implementation-dependent object.

Syntax 1: Without a body

<x:parse xml="xmlDocument" 
  [var="var" [scope="page|request|session|application"] |
   varDom="var" [scopeDom="page|request|session|application"]]
  [systemId="systemId"]
  [filter="filter"] />

Syntax 2: With a body

<x:parse 
  [var="var" [scope="page|request|session|application"] |
   varDom="var" [scopeDom="page|request|session|application"]]
  [systemId="systemId"]
  [filter="filter"]>
  xmlDocument
</x:parse>

Attributes

Attribute name

Java type

Dynamic value accepted

Description

xml

String or Reader

Yes

The XML document.

systemId

String

Yes

A URI to use as a base for relative references in the document, as an absolute URL, or as a page- or context-relative path.

filter

org.xml.sax.XMLFilter

Yes

A filter that can remove elements that aren’t of interest.

var

String

No

The variable name. The type is implementation-dependent.

scope

String

No

The variable scope.

varDom

String

No

The DOM variable name. The type is org.w3c.dom.Document.

scope

String

No

The DOM variable scope.

Example

<c:import url="http://meerkat.oreillynet.com/?&p=4999&_fl=xml&t=ALL" 
  varReader="xmlSource">
  <x:parse var="doc" xml="${xmlSource}" scope="application" />
</c:import>

Get JavaServer Pages, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.