The problem is that the empty string is not a valid value for
xs:dateTime. It is well and fine that you make the element nillable,
but if you want the value to be nil, you need

<lastModified xsi:nil="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

not just

<lastModified/>

or

<lastModified></lastModified>

As for references, I like the book, "Definitive XML Schema"
by Priscilla Walmsley. For checking the lexical representations
(formats) for the various date/time types, you could simply
look at the spec itself, it is quite understandable.
I don't have any recommendations for on-line tutorials, but
you could look at http://www.w3schools.com/schema/default.asp.


-----Original Message-----
From: Steven Crosley [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 19, 2007 1:11 PM
To: [email protected]
Subject: Re: DateTime objects

Thanks.  When the element is empty I get an error, but I set the  
element nillable=true:

<xs:element name="lastModified" type="xs:dateTime" nillable="true"/>

Here's the error:

  at java.lang.Thread.run(Thread.java:613)
Caused by: javax.servlet.ServletException:  
javax.servlet.jsp.JspException: An error occurred while evaluating  
custom action attribute "value" with value "${book.lastModified}": An  
error occurred while getting property "lastModified" from an instance  
of class org.test.testing.impl.BookImpl  
(org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid  
date value: wrong type: )
         at  
org.apache.jasper.runtime.PageContextImpl.doHandlePageException 
(PageContextImpl.java:846)
         at  
org.apache.jasper.runtime.PageContextImpl.handlePageException 
(PageContextImpl.java:779)
         at org.apache.jsp.WEB_002dINF.jsp.booksView_jsp._jspService 
(booksView_jsp.java:100)
         at org.apache.jasper.runtime.HttpJspBase.service 
(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service 
(JspServletWrapper.java:393)
         ... 121 more
Caused by:  
org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid  
date value: wrong type:
         at org.apache.xmlbeans.impl.values.XmlObjectBase 
$ValueOutOfRangeValidationContext.invalid(XmlObjectBase.java:285)

If you have any good links to web tutorials, I'd appreciate it.   
Also, is it pretty common practice to modify the model objects that  
get created from the xsd schema in order to handle error checking and  
any other data manipulation necessary or can this all be managed from  
the .xsd file?

Thanks,
Steven


On Oct 19, 2007, at 2:24 PM, Wing Yew Poon wrote:

> It is the lexical representation of xs:dateTime that XML Schema
> specifies. You may want to consult a reference on the XML Schema
> types that are used in your schema.
> The quotes are not part of the string, they are only to indicate
> a string.
>
> -----Original Message-----
> From: Steven Crosley [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 19, 2007 11:53 AM
> To: [email protected]
> Subject: Re: DateTime objects
>
> Thanks Wing,
>
> Is that a specific to XMLBeans or is this a standard way of
> displaying the date and time in an xml element?  Also, are the quotes
> necessary?
>
> Thanks,
> Steven
>
> On Oct 19, 2007, at 1:27 PM, Wing Yew Poon wrote:
>
>> The error is exactly as it says:
>>
>> Invalid date value: 2006-10-16 11:15:33
>>
>> You want something like "2006-10-16T11:15:33".
>> - Wing Yew
>>
>> -----Original Message-----
>> From: Steven Crosley [mailto:[EMAIL PROTECTED]
>> Sent: Friday, October 19, 2007 10:39 AM
>> To: [email protected]
>> Subject: DateTime objects
>>
>> Hi, I have an element in my schema that looks like this:
>>
>> <xs:element name="lastModified" type="xs:dateTime"/>
>>
>> and in my XML looks like this:
>>
>> <lastModified>2006-10-16 11:15:33</lastModified>
>>
>> When I call it in my view like this:
>>
>> <c:out value="${book.lastModified}"/>
>>
>> I get an error message that looks like the message below.  Strings
>> and Integers work fine, just this Calendar object does not.
>>
>> Thanks,
>> Steven
>>
>>
>> Caused by: javax.servlet.ServletException:
>> javax.servlet.jsp.JspException: An error occurred while evaluating
>> custom action attribute "value" with value "${book.lastModified}": An
>> error occurred while
>> getting property "lastModified" from an instance of class
>> com.testing.test.impl.BookImpl
>> (org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid
>> date value: 2006-10-16 11:15:33)        at
>> org.apache.jasper.runtime.PageContextImpl.doHandlePageException
>> (PageContextImpl.java:846)
>>          at
>> org.apache.jasper.runtime.PageContextImpl.handlePageException
>> (PageContextImpl.java:779)
>>          at org.apache.jsp.WEB_002dINF.jsp.booksView_jsp._jspService
>> (booksView_jsp.java:101)
>>          at org.apache.jasper.runtime.HttpJspBase.service
>> (HttpJspBase.java:70)
>>          at javax.servlet.http.HttpServlet.service(HttpServlet.java:
>> 803)
>>          at org.apache.jasper.servlet.JspServletWrapper.service
>> (JspServletWrapper.java:393)
>>          ... 121 more
>> Caused by:
>> org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: Invalid
>> date value: 2006-10-16 11:15:33
>>          at org.apache.xmlbeans.impl.values.XmlObjectBase
>> $ValueOutOfRangeValidationContext.invalid(XmlObjectBase.java:285)
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>> Notice:  This email message, together with any attachments, may
>> contain information  of  BEA Systems,  Inc.,  its subsidiaries
>> and  affiliated entities,  that may be confidential,  proprietary,
>> copyrighted  and/or legally privileged, and is intended solely for
>> the use of the individual or entity named in this message. If you
>> are not the intended recipient, and have received this message in
>> error, please immediately return this by email and then delete it.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> Notice:  This email message, together with any attachments, may  
> contain information  of  BEA Systems,  Inc.,  its subsidiaries   
> and  affiliated entities,  that may be confidential,  proprietary,   
> copyrighted  and/or legally privileged, and is intended solely for  
> the use of the individual or entity named in this message. If you  
> are not the intended recipient, and have received this message in  
> error, please immediately return this by email and then delete it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

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

Reply via email to