@@ -877,9 +877,16 @@ Jsonix.XML.QName.fromString = function(qNameAsString, namespaceContext, defaultN
877877		localPart  =  prefixedName ; 
878878	} 
879879	// If namespace URI was not set and we have a namespace context, try to find the namespace URI via this context 
880- 	if  ( namespaceURI  ===  null   &&   namespaceContext ) 
880+ 	if  ( namespaceURI  ===  null ) 
881881	{ 
882- 		namespaceURI  =  namespaceContext . getNamespaceURI ( prefix ) ; 
882+ 		if  ( prefix  ===  ''  &&  Jsonix . Util . Type . isString ( defaultNamespaceURI ) ) 
883+ 		{ 
884+ 			namespaceURI  =  defaultNamespaceURI ; 
885+ 		} 
886+ 		else  if  ( namespaceContext ) 
887+ 		{ 
888+ 			namespaceURI  =  namespaceContext . getNamespaceURI ( prefix ) ; 
889+ 		} 
883890	} 
884891	// If we don't have a namespace URI, assume '' by default 
885892	// TODO document the assumption 
@@ -4052,10 +4059,13 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
40524059		Jsonix . Model . TypeInfo . prototype . initialize . apply ( this ,  [ ] ) ; 
40534060	} , 	
40544061	print  : function ( value ,  context ,  output ,  scope )  { 
4055- 		throw   new   Error ( 'Abstract method [print].' ) ; 
4062+ 		return   value ; 
40564063	} , 
40574064	parse  : function ( text ,  context ,  input ,  scope )  { 
4058- 		throw  new  Error ( 'Abstract method [parse].' ) ; 
4065+ 		return  text ; 
4066+ 	} , 
4067+ 	isInstance  : function ( value ,  context ,  scope )  { 
4068+ 		return  true ; 
40594069	} , 
40604070	reprint  : function ( value ,  context ,  output ,  scope )  { 
40614071		// Only reprint when the value is a string but not an instance 
@@ -4089,7 +4099,7 @@ Jsonix.Schema.XSD.AnySimpleType = Jsonix.Class(Jsonix.Model.TypeInfo, {
40894099	} , 
40904100	CLASS_NAME  : 'Jsonix.Schema.XSD.AnySimpleType' 
40914101} ) ; 
4092- 
4102+ Jsonix . Schema . XSD . AnySimpleType . INSTANCE   =   new   Jsonix . Schema . XSD . AnySimpleType ( ) ; 
40934103Jsonix . Schema . XSD . List  =  Jsonix 
40944104		. Class ( 
40954105				Jsonix . Schema . XSD . AnySimpleType , 
@@ -5308,6 +5318,20 @@ Jsonix.Schema.XSD.Duration.INSTANCE.LIST = new Jsonix.Schema.XSD.List(Jsonix.Sch
53085318Jsonix . Schema . XSD . DateTime  =  Jsonix . Class ( Jsonix . Schema . XSD . Calendar ,  { 
53095319	name  : 'DateTime' , 
53105320	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' ) , 
53115335	parse  : function ( value ,  context ,  input ,  scope )  { 
53125336		var  calendar  =  this . parseDateTime ( value ) ; 
53135337		var  date  =  new  Date ( ) ; 
@@ -5396,14 +5420,27 @@ Jsonix.Schema.XSD.DateTime = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
53965420	isInstance  : function ( value ,  context ,  scope )  { 
53975421		return  Jsonix . Util . Type . isDate ( value ) ; 
53985422	} , 
5399- 	CLASS_NAME  : 'Jsonix.Schema.XSD.DateTime ' 
5423+ 	CLASS_NAME  : 'Jsonix.Schema.XSD.DateTimeAsDate ' 
54005424} ) ; 
5401- Jsonix . Schema . XSD . DateTime . INSTANCE  =  new  Jsonix . Schema . XSD . DateTime ( ) ; 
5402- 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 ) ; 
54035427
54045428Jsonix . Schema . XSD . Time  =  Jsonix . Class ( Jsonix . Schema . XSD . Calendar ,  { 
54055429	name  : 'Time' , 
54065430	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' ) , 
54075444	parse  : function ( value ,  context ,  input ,  scope )  { 
54085445		var  calendar  =  this . parseTime ( value ) ; 
54095446		var  date  =  new  Date ( ) ; 
@@ -5475,7 +5512,7 @@ Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
54755512				correctedValue  =  value ; 
54765513			} 
54775514			var  correctedTime  =  correctedValue . getTime ( ) ; 
5478- 			if  ( correctedTime  >=  0 )  { 
5515+ 			if  ( correctedTime  >=  ( -   localTimezone   *   60000 ) )  { 
54795516				return  this . printTime ( new  Jsonix . XML . Calendar ( { 
54805517					hour  : correctedValue . getHours ( ) , 
54815518					minute  : correctedValue . getMinutes ( ) , 
@@ -5485,10 +5522,17 @@ Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
54855522				} ) ) ; 
54865523			}  else  { 
54875524				var  timezoneHours  =  Math . ceil ( - correctedTime  /  3600000 ) ; 
5525+ 				
5526+ 				var  correctedTimeInSeconds  =  correctedValue . getSeconds ( )  + 
5527+ 					correctedValue . getMinutes ( )  *  60  + 
5528+ 					correctedValue . getHours ( )  *  3600  + 
5529+ 					timezoneHours  *  3600  - 
5530+ 					timezone  *  60 ; 
5531+ 				
54885532				return  this . printTime ( new  Jsonix . XML . Calendar ( { 
5489- 					hour  : ( correctedValue . getHours ( )   +   timezoneHours   -   timezone   /   60   )   %   24 , 
5490- 					minute  : correctedValue . getMinutes ( ) , 
5491- 					second  : correctedValue . getSeconds ( ) , 
5533+ 					hour  : correctedTimeInSeconds   %   86400 , 
5534+ 					minute  : correctedTimeInSeconds   %   3600 , 
5535+ 					second  : correctedTimeInSeconds   %   60 , 
54925536					fractionalSecond  : ( correctedValue . getMilliseconds ( )  /  1000 ) , 
54935537					timezone  : timezoneHours  *  60 
54945538				} ) ) ; 
@@ -5498,13 +5542,26 @@ Jsonix.Schema.XSD.Time = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
54985542	isInstance  : function ( value ,  context ,  scope )  { 
54995543		return  Jsonix . Util . Type . isDate ( value )  &&  value . getTime ( )  >  - 86400000  &&  value . getTime ( )  <  86400000 ; 
55005544	} , 
5501- 	CLASS_NAME  : 'Jsonix.Schema.XSD.Time ' 
5545+ 	CLASS_NAME  : 'Jsonix.Schema.XSD.TimeAsDate ' 
55025546} ) ; 
5503- Jsonix . Schema . XSD . Time . INSTANCE  =  new  Jsonix . Schema . XSD . Time ( ) ; 
5504- 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 ) ; 
55055549Jsonix . Schema . XSD . Date  =  Jsonix . Class ( Jsonix . Schema . XSD . Calendar ,  { 
55065550	name  : 'Date' , 
55075551	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' ) , 
55085565	parse  : function ( value ,  context ,  input ,  scope )  { 
55095566		var  calendar  =  this . parseDate ( value ) ; 
55105567		var  date  =  new  Date ( ) ; 
@@ -5613,10 +5670,10 @@ Jsonix.Schema.XSD.Date = Jsonix.Class(Jsonix.Schema.XSD.Calendar, {
56135670	isInstance  : function ( value ,  context ,  scope )  { 
56145671		return  Jsonix . Util . Type . isDate ( value ) ; 
56155672	} , 
5616- 	CLASS_NAME  : 'Jsonix.Schema.XSD.Date ' 
5673+ 	CLASS_NAME  : 'Jsonix.Schema.XSD.DateAsDate ' 
56175674} ) ; 
5618- Jsonix . Schema . XSD . Date . INSTANCE  =  new  Jsonix . Schema . XSD . Date ( ) ; 
5619- 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 ) ; 
56205677Jsonix . Schema . XSD . GYearMonth  =  Jsonix . Class ( Jsonix . Schema . XSD . Calendar ,  { 
56215678	name  : 'GYearMonth' , 
56225679	typeName  : Jsonix . Schema . XSD . qname ( 'gYearMonth' ) , 
@@ -5984,12 +6041,15 @@ Jsonix.Context = Jsonix
59846041			 */ 
59856042			builtinTypeInfos  : [ 
59866043			        Jsonix . Schema . XSD . AnyType . INSTANCE , 
6044+ 			        Jsonix . Schema . XSD . AnySimpleType . INSTANCE , 
59876045					Jsonix . Schema . XSD . AnyURI . INSTANCE , 
59886046					Jsonix . Schema . XSD . Base64Binary . INSTANCE , 
59896047					Jsonix . Schema . XSD . Boolean . INSTANCE , 
59906048					Jsonix . Schema . XSD . Byte . INSTANCE , 
59916049					Jsonix . Schema . XSD . Calendar . INSTANCE , 
6050+ 					Jsonix . Schema . XSD . DateAsDate . INSTANCE , 
59926051					Jsonix . Schema . XSD . Date . INSTANCE , 
6052+ 					Jsonix . Schema . XSD . DateTimeAsDate . INSTANCE , 
59936053					Jsonix . Schema . XSD . DateTime . INSTANCE , 
59946054					Jsonix . Schema . XSD . Decimal . INSTANCE , 
59956055					Jsonix . Schema . XSD . Double . INSTANCE , 
@@ -6022,6 +6082,7 @@ Jsonix.Context = Jsonix
60226082					Jsonix . Schema . XSD . Short . INSTANCE , 
60236083					Jsonix . Schema . XSD . String . INSTANCE , 
60246084					Jsonix . Schema . XSD . Strings . INSTANCE , 
6085+ 					Jsonix . Schema . XSD . TimeAsDate . INSTANCE , 
60256086					Jsonix . Schema . XSD . Time . INSTANCE , 
60266087					Jsonix . Schema . XSD . Token . INSTANCE , 
60276088					Jsonix . Schema . XSD . UnsignedByte . INSTANCE , 
0 commit comments