Loading ...
Sorry, an error occurred while loading the content.

Re: Round 2 proposall updated

Expand Messages
  • NAKAMURA, Hiroshi
    Hi, I m sorry for long long silence. ... Thank you for your comment. I m looking forward to see the regex for these datatypes. ... Yes, Date class I use
    Message 1 of 9 , Jul 18, 2001
    • 0 Attachment
      Hi,

      I'm sorry for long long silence.

      > From: Brian L. Matthews [mailto:blm@...]
      > Sent: Thursday, July 05, 2001 2:17 PM

      > > > >Decimal:
      > > > > /^([+-]?)(\d*)(?:\.(\d+)?)?$/
      > > > I think "." matches, which I'd argue isn't a valid decimal number.
      > >You are right. I've forgot trailing 0s are optional.
      > >But if leading and trailing zeroes are optional,
      > >"0.0" -> "." is legal?
      >
      > While the standard doesn't explicitly say so (that I could find),
      > leading zeroes being optional usually means you need at least 1 if
      > the number is zero. For instance, integers can have leading zeroes
      > (being derived from decimal), but I'd consider accepting "" as the
      > integer 0 a bug, just as I'd consider accepting "." as the decimal
      > 0.0 a bug.
      >
      > > >/^([+-]?\d+)-(\d+)-(\d+)T(\d\d):(\d\d):(\d\d(?:\.(\d+))?)(Z(?:[+-]\d\d:\d\d)?)?$/
      > > > Presumably you do some further validation, as things like
      > > > "2000-2000-2000T10:10:10" match.
      > >Is "([+-]?\d+)-(\d\d)-(\d\d)" better though it cannot check completely?
      >
      > It doesn't matter much. As you say, you still have to do some
      > validation after the expression match. I'd go with \d\d just because
      > it throws out some bad strings earlier, and you won't have to worry
      > about integer overflow if someone sends you
      > "2000-111111111111111111111111111111111111111111111111111111111-10T10:10:10"
      > (of course you still have to if someone sends you (the perfectly
      > valid)
      > "111111111111111111111111111111111111111111111111111111111-10-10T10:10:10"
      > :-).)

      Thank you for your comment. I'm looking forward to see the
      regex for these datatypes.

      > >In SOAP4R, Date class translate it to JD and validate it.
      >
      > Does the Date class accept really big and negative dates and
      > fractional seconds,

      Yes, Date class I use accepts big, negative and fractional
      seconds dates. But some calcuration around bc/ad seems to
      causes a problem...

      Script started on Wed Jul 18 23:01:22 2001
      0% irb
      irb(main):001:0> require 'soap/XMLSchemaDatatypes'
      true
      irb(main):002:0> d = XSD::XSDDateTime.new( "1-01-01T00:00:00" )
      #<XSDDateTime:0x2ad08b14 @data=#<Date: 3442847/2,0,2299161>, @typeNamespace="http://www.w3.org/2001/XMLSchema",
      @typeName="dateTime">
      irb(main):003:0> ( d - 1 ).to_s
      "0000-12-31T00:00:00,0Z"
      irb(main):004:0> exit
      0% exit

      Script done on Wed Jul 18 23:01:43 2001

      I think it isn't right. Collect me if I'm wrong.

      > and convert directly to UTC instead of going
      > through local time first?

      Is this help you?

      Script started on Wed Jul 18 23:04:36 2001
      0% irb
      irb(main):001:0> require 'soap/XMLSchemaDatatypes'
      true
      irb(main):002:0> d = XSD::XSDDateTime.new( "2001-01-01T00:00:00+01:00" )
      #<XSDDateTime:0x2ad08574 @data=#<Date: 58845851/24,0,2299161>, @typeNamespace="http://www.w3.org/2001/XMLSchema",
      @typeName="dateTime">
      irb(main):003:0> d.to_s
      "2000-12-31T23:00:00"
      irb(main):004:0> exit
      0% exit

      Script done on Wed Jul 18 23:05:11 2001

      Disclaimer: Date class I use above is date2 library in
      http://www.kt.rim.or.jp/~tadf/ruby-en.html#date2 and not
      bundled in Ruby's package.

      // NaHi
    Your message has been successfully submitted and would be delivered to recipients shortly.