Hi guys,
I am using JSTL to generate XML from simple queries.
I am doing it like the example I am giving below.
I am wondering - is this the right way? Should not XML be generated with
some <x:out> expressions (where x is mapped to XML taglib)? Is there to
do XPath expressions on variables like "result" from above?
I am reading JavaServer Pages Standard Tag Library specs Version 1.2
from Sun but am undecided whether I am doing XML generation the proper
way or just making ugly hacks.
========================================================================
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:sql="http://java.sun.com/jsp/jstl/sql"
xmlns:c="http://java.sun.com/jsp/jstl/core"
version="2.0">
<jsp:directive.page contentType="text/xml; charset=UTF-8"/>
<countries>
<sql:setDataSource dataSource="jdbc/wallet"
var="ds"/>
<sql:query var="result"
scope="page"
dataSource="${ds}">
SELECT ID as "id",
DESCRIPTION as "description"
FROM CURRENCY
ORDER BY ID
</sql:query>
<c:forEach var="row" items="${result.rows}">
<country>
<c:forEach var="column" items="${row}">
<<c:out value="${column.key}"/>><c:out
value="${column.value}"/></<c:out value="${column.key}"/>>
</c:forEach>
</country>
</c:forEach>
</countries>
</jsp:root>
========================================================================
Kind regards:
al_shopov
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]