tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felix Velasco <felix.vela...@kewill.com>
Subject RE: xml and date problem
Date Wed, 02 Jun 2004 16:49:12 GMT
also worked for me, in Jetty (Servlet 2.3/JSP1.2) with far older Xerces and
Xalan version.....

Xerces 1.4.3, Xalan 2.3.1

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com]
Sent: 02 June 2004 18:45
To: Tag Libraries Users List
Subject: Re: xml and date problem


I changed your example only to make it work more nicely as text output:

<%@ page contentType="text/plain" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<%@ taglib prefix="x"   uri="http://java.sun.com/jstl/xml" %>

<x:parse var="xml">
<test>
    <unit date="20040602142014">
    </unit>
    <unit date="20040602143809">
    </unit>
</test>
</x:parse>

<x:forEach select="$xml/test/unit">
    <fmt:parseDate var="updated" pattern="yyyyMMddHHmmss" type="both">
        <x:out select="@date" />
    </fmt:parseDate>
    <fmt:formatDate value="${updated}" pattern="yyyy-MM-dd HH:mm:ss" />
</x:forEach>

And got:

2004-06-02 14:20:14
2004-06-02 14:38:09

So what's the problem? ;-) I used TC 5.0.24 (running in Servlet 2.3/JSP 1.2
mode) with Xerces 2.6.2 and Xalan 2.6.0 installed in common/endorsed. Try
upgrading Xerces and Xalan.

Quoting David Goodenough <david.goodenough@btconnect.com>:

> I have a problem with either xml parsing or date formatting, I am not
quite
> sure which.
> 
> Consider the following code:-
> 
> <x:parse var="xml">
>   <test>
>     <unit date="20040602142014">
>       </unit>
>     <unit date="20040602143809">
>       </unit>
>     </test>
>   </x:parse>
> <table>
>   <x:forEach select="$xml/test/unit">
>     <fmt:parseDate var="updated" pattern="yyyyMMddHHmmss" type="both">
>       <x:out select="@date" />
>       </fmt:parseDate>
>       <TR>
>         <TD>
>           <fmt:formatDate value="${updated}" pattern="yyyy-MM-dd HH:mm:ss"
> />
>           </TD>
>         </TR>
>     </x:forEach>
>   </TABLE>
> 
> One would expect this to produce:-
> 
> 2004-06-02 14:20:14
> 2004-06-02 14:38:09
> 
> but instead it produces:-
> 
> 2004-06-02 14:20:14
> 2004-06-02 14:20:14
> 
> i.e. it repeats the first date.  If there are more than two xml items it 
> repeats the same date all the way through.
> 
> Is this a known problem, and is there a fix?
> 
> David

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message