Changeset 99
- Timestamp:
- 05/24/01 22:33:12 (7 years ago)
- Files:
-
- trunk/lib/soap/XMLSchemaDatatypes.rb (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/XMLSchemaDatatypes.rb
r84 r99 23 23 Namespace = 'http://www.w3.org/2001/XMLSchema' 24 24 InstanceNamespace = 'http://www.w3.org/2001/XMLSchema-instance' 25 26 AnyTypeLiteral = 'anyType' 25 27 NilLiteral = 'nil' 26 #Namespace = 'http://www.w3.org/1999/XMLSchema' 27 #InstanceNamespace = 'http://www.w3.org/1999/XMLSchema-instance' 28 #NilLiteral = 'null' 28 BooleanLiteral = 'boolean' 29 StringLiteral = 'string' 30 FloatLiteral = 'float' 31 DateTimeLiteral = 'dateTime' 32 Base64BinaryLiteral = 'base64Binary' 33 IntegerLiteral = 'integer' 34 IntLiteral = 'int' 35 36 # for xsd:1999 37 # Namespace = 'http://www.w3.org/1999/XMLSchema' 38 # InstanceNamespace = 'http://www.w3.org/1999/XMLSchema-instance' 39 # AnyTypeLiteral = 'ur-type' 40 # NilLiteral = 'null' 41 # DateTimeLiteral = 'timeInstant' 29 42 end 30 43 … … 80 93 81 94 def initialize( initBoolean = false ) 82 super( 'boolean')95 super( BooleanLiteral ) 83 96 set( initBoolean ) 84 97 end … … 101 114 102 115 def initialize( initString = nil ) 103 super( 'string')116 super( StringLiteral ) 104 117 set( initString ) if initString 105 118 end … … 127 140 128 141 def initialize( initFloat = nil ) 129 super( 'float')142 super( FloatLiteral ) 130 143 set( initFloat ) if initFloat 131 144 end 132 145 133 146 def set( newFloat ) 134 @data = newFloat.to_f 147 unless newFloat.is_a?( Float ) 148 # to_f understands 'NaN', 'INF', and '-INF' 149 @data = newFloat.to_f 150 else 151 @data = newFloat 152 end 153 end 154 155 # Do I have to convert 0.0 -> 0 and -0.0 -> -0 ? 156 def to_s 157 if @data.nan? 158 'NaN' 159 elsif @data.infinite? == 1 160 'INF' 161 elsif @data.infinite? == -1 162 '-INF' 163 else 164 @data.to_s 165 end 135 166 end 136 167 end … … 143 174 144 175 def initialize( initDateTime = nil ) 145 super( 'dateTime')176 super( DateTimeLiteral ) 146 177 set( initDateTime ) if initDateTime 147 178 end … … 158 189 $stderr.puts "Timezone in String is not supported. Set a Date or a Time directly!" 159 190 end 160 @data = Date.new3( year, mon, mday, hour, min )191 @data = Date.new3( year, mon, mday, hour, min, sec ) 161 192 end 162 193 end … … 172 203 # String in Ruby could be a binary. 173 204 def initialize( initString = nil ) 174 super( 'base64Binary')205 super( Base64BinaryLiteral ) 175 206 set( initString ) if initString 176 207 end … … 184 215 end 185 216 186 def to _s217 def toString 187 218 @data.unpack( "m" )[ 0 ] 188 219 end … … 198 229 def initialize( initInteger = nil ) 199 230 super() 200 @typeName = 'integer'231 @typeName = IntegerLiteral 201 232 set( initInteger ) if initInteger 202 233 end … … 212 243 def initialize( initInt = nil ) 213 244 super() 214 @typeName = 'int'245 @typeName = IntLiteral 215 246 set( initInt ) if initInt 216 247 end