Skip to content

Commit a85473c

Browse files
committed
Fixes #132.
1 parent 8e27a90 commit a85473c

File tree

19 files changed

+629
-534
lines changed

19 files changed

+629
-534
lines changed

nodejs/scripts/jsonix.js

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4059,10 +4059,13 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
40594059
Jsonix.Model.TypeInfo.prototype.initialize.apply(this, []);
40604060
},
40614061
print : function(value, context, output, scope) {
4062-
throw new Error('Abstract method [print].');
4062+
return value;
40634063
},
40644064
parse : function(text, context, input, scope) {
4065-
throw new Error('Abstract method [parse].');
4065+
return text;
4066+
},
4067+
isInstance : function(value, context, scope) {
4068+
return true;
40664069
},
40674070
reprint : function(value, context, output, scope) {
40684071
// Only reprint when the value is a string but not an instance
@@ -4096,7 +4099,7 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
40964099
},
40974100
CLASS_NAME : 'Jsonix.Schema.XSD.AnySimpleType'
40984101
});
4099-
4102+
Jsonix.Schema.XSD.AnySimpleType.INSTANCE = new Jsonix.Schema.XSD.AnySimpleType();
41004103
Jsonix.Schema.XSD.List = Jsonix
41014104
.Class(
41024105
Jsonix.Schema.XSD.AnySimpleType,
@@ -5315,6 +5318,20 @@ Jsonix.Schema.XSD.Duration.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Sch
53155318
Jsonix.Schema.XSD.DateTime = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
53165319
name : 'DateTime',
53175320
typeName : Jsonix.Schema.XSD.qname('dateTime'),
5321+
parse : function(value, context, input, scope) {
5322+
return this.parseDateTime(value);
5323+
},
5324+
print : function(value, context, output, scope) {
5325+
return this.printDateTime(value);
5326+
},
5327+
CLASS_NAME : 'Jsonix.Schema.XSD.DateTime'
5328+
});
5329+
Jsonix.Schema.XSD.DateTime.INSTANCE = new Jsonix.Schema.XSD.DateTime();
5330+
Jsonix.Schema.XSD.DateTime.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTime.INSTANCE);
5331+
5332+
Jsonix.Schema.XSD.DateTimeAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
5333+
name : 'DateTimeAsDate',
5334+
typeName : Jsonix.Schema.XSD.qname('dateTime'),
53185335
parse : function(value, context, input, scope) {
53195336
var calendar = this.parseDateTime(value);
53205337
var date = new Date();
@@ -5403,14 +5420,27 @@ Jsonix.Schema.XSD.DateTime = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
54035420
isInstance : function(value, context, scope) {
54045421
return Jsonix.Util.Type.isDate(value);
54055422
},
5406-
CLASS_NAME : 'Jsonix.Schema.XSD.DateTime'
5423+
CLASS_NAME : 'Jsonix.Schema.XSD.DateTimeAsDate'
54075424
});
5408-
Jsonix.Schema.XSD.DateTime.INSTANCE = new Jsonix.Schema.XSD.DateTime();
5409-
Jsonix.Schema.XSD.DateTime.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTime.INSTANCE);
5425+
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE = new Jsonix.Schema.XSD.DateTimeAsDate();
5426+
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE);
54105427

54115428
Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
54125429
name : 'Time',
54135430
typeName : Jsonix.Schema.XSD.qname('time'),
5431+
parse : function(value, context, input, scope) {
5432+
return this.parseTime(value);
5433+
},
5434+
print : function(value, context, output, scope) {
5435+
return this.printTime(value);
5436+
},
5437+
CLASS_NAME : 'Jsonix.Schema.XSD.Time'
5438+
});
5439+
Jsonix.Schema.XSD.Time.INSTANCE = new Jsonix.Schema.XSD.Time();
5440+
Jsonix.Schema.XSD.Time.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Time.INSTANCE);
5441+
Jsonix.Schema.XSD.TimeAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
5442+
name : 'TimeAsDate',
5443+
typeName : Jsonix.Schema.XSD.qname('time'),
54145444
parse : function(value, context, input, scope) {
54155445
var calendar = this.parseTime(value);
54165446
var date = new Date();
@@ -5512,13 +5542,26 @@ Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
55125542
isInstance : function(value, context, scope) {
55135543
return Jsonix.Util.Type.isDate(value) && value.getTime() > -86400000 && value.getTime() < 86400000;
55145544
},
5515-
CLASS_NAME : 'Jsonix.Schema.XSD.Time'
5545+
CLASS_NAME : 'Jsonix.Schema.XSD.TimeAsDate'
55165546
});
5517-
Jsonix.Schema.XSD.Time.INSTANCE = new Jsonix.Schema.XSD.Time();
5518-
Jsonix.Schema.XSD.Time.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Time.INSTANCE);
5547+
Jsonix.Schema.XSD.TimeAsDate.INSTANCE = new Jsonix.Schema.XSD.TimeAsDate();
5548+
Jsonix.Schema.XSD.TimeAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.TimeAsDate.INSTANCE);
55195549
Jsonix.Schema.XSD.Date = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
55205550
name : 'Date',
55215551
typeName : Jsonix.Schema.XSD.qname('date'),
5552+
parse : function(value, context, input, scope) {
5553+
return this.parseDate(value);
5554+
},
5555+
print : function(value, context, output, scope) {
5556+
return this.printDate(value);
5557+
},
5558+
CLASS_NAME : 'Jsonix.Schema.XSD.Date'
5559+
});
5560+
Jsonix.Schema.XSD.Date.INSTANCE = new Jsonix.Schema.XSD.Date();
5561+
Jsonix.Schema.XSD.Date.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Date.INSTANCE);
5562+
Jsonix.Schema.XSD.DateAsDate = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
5563+
name : 'DateAsDate',
5564+
typeName : Jsonix.Schema.XSD.qname('date'),
55225565
parse : function(value, context, input, scope) {
55235566
var calendar = this.parseDate(value);
55245567
var date = new Date();
@@ -5627,10 +5670,10 @@ Jsonix.Schema.XSD.Date = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
56275670
isInstance : function(value, context, scope) {
56285671
return Jsonix.Util.Type.isDate(value);
56295672
},
5630-
CLASS_NAME : 'Jsonix.Schema.XSD.Date'
5673+
CLASS_NAME : 'Jsonix.Schema.XSD.DateAsDate'
56315674
});
5632-
Jsonix.Schema.XSD.Date.INSTANCE = new Jsonix.Schema.XSD.Date();
5633-
Jsonix.Schema.XSD.Date.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.Date.INSTANCE);
5675+
Jsonix.Schema.XSD.DateAsDate.INSTANCE = new Jsonix.Schema.XSD.DateAsDate();
5676+
Jsonix.Schema.XSD.DateAsDate.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Schema.XSD.DateAsDate.INSTANCE);
56345677
Jsonix.Schema.XSD.GYearMonth = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
56355678
name : 'GYearMonth',
56365679
typeName : Jsonix.Schema.XSD.qname('gYearMonth'),
@@ -5998,12 +6041,15 @@ Jsonix.Context = Jsonix
59986041
*/
59996042
builtinTypeInfos : [
60006043
Jsonix.Schema.XSD.AnyType.INSTANCE,
6044+
Jsonix.Schema.XSD.AnySimpleType.INSTANCE,
60016045
Jsonix.Schema.XSD.AnyURI.INSTANCE,
60026046
Jsonix.Schema.XSD.Base64Binary.INSTANCE,
60036047
Jsonix.Schema.XSD.Boolean.INSTANCE,
60046048
Jsonix.Schema.XSD.Byte.INSTANCE,
60056049
Jsonix.Schema.XSD.Calendar.INSTANCE,
6050+
Jsonix.Schema.XSD.DateAsDate.INSTANCE,
60066051
Jsonix.Schema.XSD.Date.INSTANCE,
6052+
Jsonix.Schema.XSD.DateTimeAsDate.INSTANCE,
60076053
Jsonix.Schema.XSD.DateTime.INSTANCE,
60086054
Jsonix.Schema.XSD.Decimal.INSTANCE,
60096055
Jsonix.Schema.XSD.Double.INSTANCE,
@@ -6036,6 +6082,7 @@ Jsonix.Context = Jsonix
60366082
Jsonix.Schema.XSD.Short.INSTANCE,
60376083
Jsonix.Schema.XSD.String.INSTANCE,
60386084
Jsonix.Schema.XSD.Strings.INSTANCE,
6085+
Jsonix.Schema.XSD.TimeAsDate.INSTANCE,
60396086
Jsonix.Schema.XSD.Time.INSTANCE,
60406087
Jsonix.Schema.XSD.Token.INSTANCE,
60416088
Jsonix.Schema.XSD.UnsignedByte.INSTANCE,

0 commit comments

Comments
 (0)