About us
Products
Services
Articles
Contact us

XML Output JSP Actions - Tag Reference

JSP Tag Library for Generating XML Dynamically

ActionDescription
document Outputs a DOM tree or just sets the context for generating an XML document dynamically.
fragment Outputs a DOM fragment/sub-tree.
element Outputs an XML element.
start Outputs an XML start tag.
end Outputs an XML end tag.
attributes Exports a variable holding a SAX list of attributes.
attribute Adds an attribute to a variable exported by <o:attributes>.
data Outputs XML character data.
comment Outputs an XML comment.
pi Outputs an XML processing instruction.


<document>

Outputs a DOM tree or just sets the context for generating an XML document dynamically.

Syntax: Serializing a DOM tree
<o:document dom="DOM node" [xmldecl="true|false"] [standalone="true|false"] [version="1.0"] [encoding="string"] [systemId="string"] [publicId="string"] [method="xml|html|text"] [indent="number"]/>

Syntax: Generating a document dynamically
<o:document [xmldecl="true|false"] [standalone="true|false"] [version="1.0"] [encoding="string"] [systemId="string"] [publicId="string"] [method="xml|html|text"] [indent="number"]>
...actions that generate XML content...
</o:document>

AttributeDynamicTypeDefaultDescription
domyesorg.w3c.dom.Nodenull DOM tree that must be serialized to the JSP output.
xmldeclyesbooleantrue Flag indicating if the XML declaration should be included at the beginning of the produced XML document.
standaloneyesbooleanfalse Flag indicating if the document should be declared standalone.
versionyesString1.0 XML version.
encodingyesStringUTF-8 XML encoding.
publicIdyesStringnull Public doctype identifier of the produced XML document.
systemIdyesStringnull System doctype identifier of the produced XML document.
methodyesStringxml Output method: xml, html, text.
indentyesint0 Number of spaces used for indenting.


<fragment>

Outputs a DOM fragment/sub-tree.

Syntax:
<o:fragment dom="DOM node" [method="xml|html|text"] [indent="number"]/>

AttributeDynamicTypeDefaultDescription
domyesorg.w3c.dom.Nodenull DOM sub-tree that must be serialized to the JSP output.
methodyesStringxml Output method: xml, html, text.
indentyesint0 Number of spaces used for indenting.


<element>

Outputs an XML element.

Syntax:
<o:element name="string" [uri="string"] [attr="attributes"] [empty="true|false"]>
...actions that generate the element's content...
<o:/element>

AttributeDynamicTypeDefaultDescription
nameyesStringnull Name of the element.
uriyesStringnull Namespace URI of the element, which will be the value of an XMLNS attribute.
attryesString
org.xml.sax.helpers.AttributesImpl
null Attributes of the element. The value of the evaluated expression is expected to be a SAX AttributesImpl object or a list of names of JSP variables separated by spaces. In the latter case, the attributes will have the names and values of the JSP variables.
emptyyesbooleanfalse Flag indicating if the produced element must be empty.


<start>

Outputs an XML start tag.

Syntax:
<o:start name="string" [uri="string"] [attr="attributes"]/>

AttributeDynamicTypeDefaultDescription
nameyesStringnull Name of the XML tag.
uriyesStringnull Namespace URI of the XML tag, which will be the value of an XMLNS attribute.
attryesString
org.xml.sax.helpers.AttributesImpl
null Attributes of the XML tag. The value of the evaluated expression is expected to be a SAX AttributesImpl object or a list of names of JSP variables separated by spaces. In the latter case, the attributes will have the names and values of the JSP variables.


<end>

Outputs an XML end tag.

Syntax:
<o:end name="string"/>

AttributeDynamicTypeDefaultDescription
nameyesStringnull Name of the XML tag.


<attributes>

Exports a variable holding a SAX list of attributes.

Syntax:
<o:attributes var="name" [scope="page|request|session|application"] [copy="attributes"]>
...</o:attribute> actions...
</o:attributes>

AttributeDynamicTypeDefaultDescription
varnoStringnull Name of the variable exported by this action. The value of the variable will be the SAX object that holds the attributes.
scopenoStringpage Scope of the variable exported by this action.
copyyesorg.xml.sax.helpers.AttributesImplnull Initial attribute list, which is empty by default. The value of the evaluated expression is expected to be a org.xml.sax.helpers.AttributesImpl object. The list of attributes exported by this action will contain copies of all attributes of the given initial list.


<attribute>

Adds an attribute to a variable exported by <o:attributes>.

Syntax: Value specified via an attribute
<o:attribute name="string" value="string"/>

Syntax: Value specified via the body content
<o:attribute name="string">
...value...
</o:attribute>

AttributeDynamicTypeDefaultDescription
nameyesStringnull Attribute name.
valueyesStringnull Attribute value.


<data>

Outputs XML character data.

Syntax: Data specified via an attribute
<o:data value="string" [section="boolean"]/>

Syntax: Data specified via the body content
<o:data [section="boolean]">
...value...
</o:data>

AttributeDynamicTypeDefaultDescription
valueyesStringnull Character data.
sectionyesbooleanfalse Flag indicating if the character data should be produced as a CDATA section.


<comment>

Outputs an XML comment.

Syntax: Comment specified via an attribute
<o:comment text="string"/>

Syntax: Comment specified via the body content
<o:comment>
...text...
</o:comment>

AttributeDynamicTypeDefaultDescription
textyesStringnull Text of the comment.


<pi>

Outputs an XML processing instruction.

Syntax: Data specified via an attribute
<o:pi target="string" data="string"/>

Syntax: Data specified via the body content
<o:pi target="string">
...data...
</o:pi>

AttributeDynamicTypeDefaultDescription
targetyesStringnull Target of the processing instruction.
datayesStringnull Data of the processing instruction.

Copyright © 2000-2020 Devsphere

About us
Products
Services
Articles
Contact us