About us
Contact us
Products
Services
Articles
 Twitter    Bookmark and Share

XML Processing JSP Actions - Tag Reference

JSP Tag Library for Fast and Easy XML Parsing

ActionDescription
parse Parses an XML document using SAX internally.
element Exports variables that hold an element's namespace URI, local name, qualified name and attributes.
start Can be placed within <p:parse> or <p:element> in order to handle a startDocument() or startElement() SAX event.
end Can be placed within <p:parse> or <p:element> in order to handle an endDocument() or endElement() SAX event.
data Can be placed within <p:element> in order to handle characters() SAX events.
pi Can be placed within <p:parse> or <p:element> in order to handle processingInstruction() SAX events.


<parse>

Parses an XML document using SAX internally. The body may contain a <p:start> action for processing the startDocument() SAX event, followed by a <p:element> action for processing the document's root element, followed by an optional <p:end> action for processing the endDocument() SAX event.

Syntax: XML content specified via an input source
<p:parse xml="XML content" [systemId="string"] [validate="true|false"] [ignoreSpaces="true|false"]>
....actions that process the XML content...
</p:parse>

Syntax: XML content specified via a system identifier
<p:parse systemId="string" [validate="true|false"] [ignoreSpaces="true|false"]>
...actions that process the XML content...
</p:parse>

AttributeDynamicTypeDefaultDescription
xmlyes org.xml.sax.InputSource
java.io.InputStream
java.io.Reader
String
null XML input source that must be parsed.
systemIdyesStringnull System identifier of the XML input source that must be parsed.
validateyesbooleanfalse Flag indicating if the parser should validate the XML input source.
ignoreSpacesyesbooleanfalse Flag indicating if space character data should be ignored.


<element>

Exports variables that hold an element's namespace URI, local name, qualified name and attributes. The body may process a DOM sub-tree or may contain sub-actions that process the SAX events that are generated between a startElement() event and an endElement() event. If the varDom attribute is present, this action exports a variable holding the root element of a DOM sub-tree and the body may not contain any actions of this library. If the varDom attribute isn't present, no DOM variable is exported and the body may contain a <p:start> action for processing the startElement() SAX event, followed by one or more <p:element> and <p:data> actions for processing the sub-elements and the character data, followed by an optional <p:end> action for processing the endElement() SAX event.

Syntax: Processing a DOM sub-tree
<p:element varDom="name" [scopeDom="page|request|session|application"] [varName="name"] [scopeName="page|request|session|application"] [testName="string"] [varQname="name"] [scopeQname="page|request|session|application"] [testQname="string"] [varUri="name"] [scopeUri="page|request|session|application"] [testUri="string"] [varAttr="name"] [scopeAttr="page|request|session|application"] [scope="page|request|session|application"] [test="boolean"]>
...scripting code that processes the DOM sub-tree...
</p:element>

Syntax: Processing a sequence of SAX events
<p:element [varName="name"] [scopeName="page|request|session|application"] [testName="string"] [varQname="name"] [scopeQname="page|request|session|application"] [testQname="string"] [varUri="name"] [scopeUri="page|request|session|application"] [testUri="string"] [varAttr="name"] [scopeAttr="page|request|session|application"] [scope="page|request|session|application"] [test="boolean"]>
...actions that process the SAX events...
</p:element>

AttributeDynamicTypeDefaultDescription
varDomnoStringnull Name of the dom variable exported by this action. The presence of this variable indicates that the application wants a DOM tree for processing rather than a sequence of SAX events. The root node of the DOM sub-tree will be the value of the dom variable.
scopeDomnoStringpage Scope of the dom variable exported by this action.
varNamenoStringname Name of the name variable exported by this action. The element's local name will be the value of the name variable.
scopeNamenoStringpage Scope of the name variable exported by this action.
testNameyesStringnull If this attribute is present and its value is not the same as the local name of the current parsed element, the body content of <p:element> will not be evaluated.
varQnamenoStringqname Name of the qname variable exported by this action. The element's qualified name will be the value of the qname variable.
scopeQnamenoStringpage Scope of the qname variable exported by this action.
testQnameyesStringnull If this attribute is present and its value is not the same as the qualified name of the current parsed element, the body content of <p:element> will not be evaluated.
varUrinoStringuri Name of the uri variable exported by this action. The element's namespace URI will be the value of the uri variable.
scopeUrinoStringpage Scope of the uri variable exported by this action.
testUriyesStringnull If this attribute is present and its value is not the same as the namespace URI of the current parsed element, the body content of <p:element> will not be evaluated.
varAttrnoStringattr Name of the attr variable exported by this action. The element's attributes will be the value of the attr variable.
scopeAttrnoStringpage Scope of the attr variable exported by this action.
scopenoStringpage Default scope for the variables exported by this action.
testyesbooleantrue If this attribute is present and it evaluates to false, the body of <p:element> will not be evaluated.


<start>

Can be placed within <p:parse> or <p:element> in order to handle a startDocument() or startElement() SAX event.

Syntax:
<p:start>
...scripting code that processes the SAX event...
</p:parse>


<end>

Can be placed within <p:parse> or <p:element> in order to handle an endDocument() or endElement() SAX event.

Syntax:
<p:end>
...scripting code that processes the SAX event...
</p:end>


<data>

Can be placed within <p:element> in order to handle characters() SAX events. It exports a variable that holds the character data.

Syntax:
<p:data [varData="name"] [scopeData="page|request|session|application"] [scope="page|request|session|application"]>
...scripting code that processes the SAX event...
</p:data>

AttributeDynamicTypeDefaultDescription
varDatanoStringdata Name of the data variable exported by this action. The value of the data variable will be the XML character data.
scopeDatanoStringpage Scope of the data variable exported by this action.
scopenoStringpage Default scope for the variables exported by this action.


<pi>

Can be placed within <p:parse> or <p:element> in order to handle processingInstruction() SAX events. It exports two variables that hold the target and data of the processing instruction.

Syntax:
<p:pi [varTarget="name"] [scopeTarget="page|request|session|application"] [testTarget="string"] [varData="name"] [scopeData="page|request|session|application"] [scope="page|request|session|application"] [test="boolean"]>
...scripting code that processes the SAX event...
</p:pi>

AttributeDynamicTypeDefaultDescription
varTargetnoStringtarget Name of the target variable exported by this action. The processing instruction's target will be the value of the target variable.
scopeTargetnoStringpage Scope of the target variable exported by this action.
testTargetyesStringnull If this attribute is present and its value is not the same as the target of the current processing instruction, the body content of <p:pi> will not be evaluated.
varDatanoStringdata Name of the data variable exported by this action. The processing instruction's data will be the value of the data variable.
scopeDatanoStringpage Scope of the data variable exported by this action.
scopenoStringpage Default scope for the variables exported by this action.
testyesbooleantrue If this attribute is present and it evaluates to false, the body of <p:pi> will not be evaluated.

Copyright © 2000-2009 Devsphere

About us
Contact us
Products
Services
Articles