On Wednesday 02 June 2004 17:52, Felix Velasco wrote:
> have you tried this:
>
> <x:parse var="myxml">
>   <test>
>     <unit date="20040602142014">
>       </unit>
>     <unit date="20040602143809">
>       </unit>
>     </test>
>   </x:parse>
> <table>
>   <x:forEach select="$myxml/test/unit">
>       <TR>
>         <TD>
>               <x:out select="@date" />
>           </TD>
>         </TR>
>     </x:forEach>
>   </TABLE>
>
> ,just to see if it's really an xml problem, or has something to do with the
> "updated" var, the fmt tags?
>

Tried this, and I get the correct answers.  So it is fmt problem.

BTW, I am using Tomcat4 and therefore the older JSTL code.

David

> -----Original Message-----
> From: Felix Velasco [mailto:[EMAIL PROTECTED]
> Sent: 02 June 2004 18:49
> To: 'Tag Libraries Users List'
> Subject: RE: xml and date problem
>
>
> 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:[EMAIL PROTECTED]
> 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 <[EMAIL PROTECTED]>:
> > 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to