JSP Tag Library for Generating XML Dynamically
Devsphere XML JSP Tag Library (XJTL) comes with a code builder that takes a sample XML document and generates a JSP page that outputs the sample XML content. You may edit the generated JSP in order to make it more general so that it can output XML documents that are similar to the given XML sample.
Syntax
java com.devsphere.xml.taglib.output.builder.Main
-sample XML_file_path
-output JSP_file_path
where
XML_file_path is the file path of the sample XML file
JSP_file_path is the file path of the JSP that will be generated
Example
This is the Dynamic.jsp example explained in a different page of this documentation.
Command Line:
java com.devsphere.xml.taglib.output.builder.Main
-sample xjtldemo\output\sample.xml -output xjtldemo\builder\output.jsp
Generated Code:
<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
<%@ taglib prefix="o" uri="http://devsphere.com/xml/taglib/output" %>
<o:document>
<c:set var="id" value="js890"/>
<o:element name="person" attr="id">
<o:element name="name">
<o:data>John Smith</o:data>
</o:element>
<o:element name="email">
<o:data>[email protected]</o:data>
</o:element>
<o:element name="phone">
<o:data>650-123-4567</o:data>
</o:element>
<c:set var="city" value="Palo Alto"/>
<c:set var="state" value="CA"/>
<c:set var="zip" value="94303"/>
<c:set var="country" value="USA"/>
<o:element name="address" attr="city state zip country">
<o:element name="line1">
<o:data>JS Information Systems, Inc.</o:data>
</o:element>
<o:element name="line2">
<o:data>1001 San Antonio Road</o:data>
</o:element>
</o:element>
</o:element>
</o:document>
|