I'm a new Orbeon and XForms user, and I'm slowly coming up to speed on
how XForms work. I ran into something today that might be a bug, though I'm not sure: validation of an element I have bound as a special type that contains a union of w3c date types allows months and days out of range to pass through. Here's what I have in my xsd: <xs:simpleType name="uwdcdate"> <xs:union memberTypes="xs:gYear xs:gYearMonth xs:date"/> </xs:simpleType> Here's what I have in my xhtml file: <xforms:bind nodeset="instance('mods-instance')/mods:origininfo/mods:dateIssued" type="uwdc:uwdcdate"/> and here's my control: <xforms:input ref="mods:dateIssued" incremental="true" id="additional-date"> <xforms:label>Date</xforms:label> <xforms:help>Must be in form "YYYY[-MM][-DD].</xforms:help> </xforms:input> What I'm seeing is that it accepts four digits, optionally followed by a dash and two digits, then optionally followed by another dash and two more digits, and rejects everything else. So far so good. But it accepts *any* two digits in the month field, not just 01 - 12; and it accepts *any* two digits in the day field, rather than 01 - 31, as defined by the W3C specification for xs:date. Validation seems to be incomplete. Am I missing something? thanks, -- Scott -- Scott Prater Library, Instructional, and Research Applications (LIRA) Division of Information Technology (DoIT) University of Wisconsin - Madison -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
I did some more testing, just to make sure the xs:union wasn't throwing a
wrench in the works. I tried entering a date of type xs:date, and found the same problem: days and months can be any two-digit integer. Is this properly not an Orbeon problem, but an xs validation problem? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
In reply to this post by Scott Prater
I implemented a workaround for constarining months and dates. A colleague of
mine found a regular expression pattern for dates that was used in the relax NG schema for EAD documents. Here's my modified date xs:simpleType in my xsd file: <xs:simpleType name="uwdcdate"> <xs:restriction base="xs:string"> <xs:pattern value="(\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)(/\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)?"/> </xs:restriction> </xs:simpleType> It's big and ugly, but it works. -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Administrator
|
I reproduced this, and it appeared to be a bug in MSV's xsdlib. I also
found this message, without reply: https://msv.dev.java.net/servlets/ReadMsg?list=users&msgNo=107 I patched xsdlib to strictly validate date types. Hopefully this will be more correct than before! Bug http://forge.ow2.org/tracker/index.php?func=detail&aid=314812&group_id=168&atid=350207 Changes http://github.com/orbeon/msv/blob/master/xsdlib/src/com/sun/msv/datatype/xsd/datetime/CalendarParser.java -Erik On Mon, Mar 8, 2010 at 10:19 AM, <[hidden email]> wrote: > I implemented a workaround for constarining months and dates. A colleague of > mine found a regular expression pattern for dates that was used in the relax NG > schema for EAD documents. > > Here's my modified date xs:simpleType in my xsd file: > > <xs:simpleType name="uwdcdate"> > <xs:restriction base="xs:string"> > <xs:pattern > value="(\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)(/\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)?"/> > > </xs:restriction> > </xs:simpleType> > > It's big and ugly, but it works. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks, Erik!
-- Scott Erik Bruchez wrote: > I reproduced this, and it appeared to be a bug in MSV's xsdlib. I also > found this message, without reply: > > https://msv.dev.java.net/servlets/ReadMsg?list=users&msgNo=107 > > I patched xsdlib to strictly validate date types. Hopefully this will > be more correct than before! > > Bug > http://forge.ow2.org/tracker/index.php?func=detail&aid=314812&group_id=168&atid=350207 > > Changes > http://github.com/orbeon/msv/blob/master/xsdlib/src/com/sun/msv/datatype/xsd/datetime/CalendarParser.java > > -Erik > > On Mon, Mar 8, 2010 at 10:19 AM, <[hidden email]> wrote: >> I implemented a workaround for constarining months and dates. A colleague of >> mine found a regular expression pattern for dates that was used in the relax NG >> schema for EAD documents. >> >> Here's my modified date xs:simpleType in my xsd file: >> >> <xs:simpleType name="uwdcdate"> >> <xs:restriction base="xs:string"> >> <xs:pattern >> value="(\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)(/\-?(0|1|2)([0-9]{3})(((01|02|03|04|05|06|07|08|09|10|11|12)((0[1-9])|((1|2)[0-9])|(3[0-1])))|\-((01|02|03|04|05|06|07|08|09|10|11|12)(\-((0[1-9])|((1|2)[0-9])|(3[0-1])))?))?)?"/> >> >> </xs:restriction> >> </xs:simpleType> >> >> It's big and ugly, but it works. >> >> >> -- >> You receive this message as a subscriber of the [hidden email] mailing list. >> To unsubscribe: mailto:[hidden email] >> For general help: mailto:[hidden email]?subject=help >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> -- Scott Prater Library, Instructional, and Research Applications (LIRA) Division of Information Technology (DoIT) University of Wisconsin - Madison [hidden email] -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws smime.p7s (4K) Download Attachment |
Free forum by Nabble | Edit this page |