Skip to content

Commit 6362e86

Browse files
committed
Reverted some of the changes prior to the release. Issue #70.
1 parent 21baad4 commit 6362e86

File tree

6 files changed

+43
-34
lines changed

6 files changed

+43
-34
lines changed

dist/Jsonix-all.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,14 +1929,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
19291929
var result = null;
19301930
// Issue #70 work in progress here
19311931
var xsiTypeInfo = null;
1932+
/*
19321933
if (context.supportXsiType) {
19331934
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
19341935
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
19351936
{
19361937
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
19371938
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
19381939
}
1939-
}
1940+
}*/
19401941
var name = input.getName();
19411942
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
19421943
if (Jsonix.Util.Type.exists(typeInfo))
@@ -2145,11 +2146,14 @@ Jsonix.Model.ClassInfo = Jsonix
21452146
// TODO optionally report a validation error that the element is not expected
21462147
et = input.skipElement();
21472148
}
2148-
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE) && Jsonix.Util.Type.exists(this.structure.mixed)) {
2149-
// Characters and structure has a mixed property
2150-
var mixedPropertyInfo = this.structure.mixed;
2151-
this.unmarshalProperty(context, input,
2152-
mixedPropertyInfo, result);
2149+
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
2150+
if (Jsonix.Util.Type.exists(this.structure.mixed))
2151+
{
2152+
// Characters and structure has a mixed property
2153+
var mixedPropertyInfo = this.structure.mixed;
2154+
this.unmarshalProperty(context, input,
2155+
mixedPropertyInfo, result);
2156+
}
21532157
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
21542158
// Ignore
21552159
} else {

dist/Jsonix-min.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -759,18 +759,15 @@ h(that.unmarshalDocument(b))
759759
var e=null;
760760
d.nextTag();
761761
return this.unmarshalElement(this.context,d)
762-
},unmarshalElement:function(u,r,n){if(r.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next text.")
763-
}var l=null;
764-
var m=null;
765-
if(u.supportXsiType){var t=r.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI,Jsonix.Schema.XSI.TYPE);
766-
if(Jsonix.Util.StringUtils.isNotBlank(t)){var p=Jsonix.Schema.XSD.QName.INSTANCE.parse(t,u,r,n);
767-
m=u.getTypeInfoByTypeNameKey(p.key)
768-
}}var v=r.getName();
769-
var o=m?m:this.getElementTypeInfo(v,u,n);
770-
if(Jsonix.Util.Type.exists(o)){var q=o.unmarshal(u,r,n);
771-
var s=this.convertToElementValue({name:v,value:q},u,r,n);
772-
return s
773-
}else{throw new Error("Element ["+v.key+"] is not known in this context.")
762+
},unmarshalElement:function(q,o,l){if(o.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next text.")
763+
}var j=null;
764+
var k=null;
765+
var r=o.getName();
766+
var m=k?k:this.getElementTypeInfo(r,q,l);
767+
if(Jsonix.Util.Type.exists(m)){var n=m.unmarshal(q,o,l);
768+
var p=this.convertToElementValue({name:r,value:n},q,o,l);
769+
return p
770+
}else{throw new Error("Element ["+r.key+"] is not known in this context.")
774771
}},getElementTypeInfo:function(f,e,g){var h=e.getElementInfo(f,g);
775772
if(Jsonix.Util.Type.exists(h)){return h.typeInfo
776773
}else{return undefined
@@ -841,9 +838,9 @@ this.unmarshalProperty(B,w,r,p)
841838
}else{if(Jsonix.Util.Type.exists(this.structure.any)){var s=this.structure.any;
842839
this.unmarshalProperty(B,w,s,p)
843840
}else{v=w.skipElement()
844-
}}}else{if((v===Jsonix.XML.Input.CHARACTERS||v===Jsonix.XML.Input.CDATA||v===Jsonix.XML.Input.ENTITY_REFERENCE)&&Jsonix.Util.Type.exists(this.structure.mixed)){var x=this.structure.mixed;
841+
}}}else{if((v===Jsonix.XML.Input.CHARACTERS||v===Jsonix.XML.Input.CDATA||v===Jsonix.XML.Input.ENTITY_REFERENCE)){if(Jsonix.Util.Type.exists(this.structure.mixed)){var x=this.structure.mixed;
845842
this.unmarshalProperty(B,w,x,p)
846-
}else{if(v===Jsonix.XML.Input.SPACE||v===Jsonix.XML.Input.COMMENT||v===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+v+"].")
843+
}}else{if(v===Jsonix.XML.Input.SPACE||v===Jsonix.XML.Input.COMMENT||v===Jsonix.XML.Input.PROCESSING_INSTRUCTION){}else{throw new Error("Illegal state: unexpected event type ["+v+"].")
847844
}}}v=w.next()
848845
}}else{if(Jsonix.Util.Type.exists(this.structure.value)){var t=this.structure.value;
849846
this.unmarshalProperty(B,w,t,p)

nodejs/scripts/jsonix.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,14 +1929,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
19291929
var result = null;
19301930
// Issue #70 work in progress here
19311931
var xsiTypeInfo = null;
1932+
/*
19321933
if (context.supportXsiType) {
19331934
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
19341935
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
19351936
{
19361937
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
19371938
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
19381939
}
1939-
}
1940+
}*/
19401941
var name = input.getName();
19411942
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
19421943
if (Jsonix.Util.Type.exists(typeInfo))
@@ -2145,11 +2146,14 @@ Jsonix.Model.ClassInfo = Jsonix
21452146
// TODO optionally report a validation error that the element is not expected
21462147
et = input.skipElement();
21472148
}
2148-
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE) && Jsonix.Util.Type.exists(this.structure.mixed)) {
2149-
// Characters and structure has a mixed property
2150-
var mixedPropertyInfo = this.structure.mixed;
2151-
this.unmarshalProperty(context, input,
2152-
mixedPropertyInfo, result);
2149+
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
2150+
if (Jsonix.Util.Type.exists(this.structure.mixed))
2151+
{
2152+
// Characters and structure has a mixed property
2153+
var mixedPropertyInfo = this.structure.mixed;
2154+
this.unmarshalProperty(context, input,
2155+
mixedPropertyInfo, result);
2156+
}
21532157
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
21542158
// Ignore
21552159
} else {

nodejs/scripts/tests/GH70/GH70.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module.exports = {
2929
test.equal("GH70.Literal", data.value.TYPE_NAME);
3030
test.equal("test", data.value.value);
3131
test.done();
32-
},
32+
},/*
3333
"ExpressionAsLiteral" : function(test) {
3434
var unmarshaller = context.createUnmarshaller();
3535
var data = unmarshaller.unmarshalString('<Expression xmlns="urn:GH70" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Literal">test</Expression>');
@@ -43,7 +43,7 @@ module.exports = {
4343
test.equal("GH70.And", data.value.TYPE_NAME);
4444
test.equal(2, data.value.expressions.length);
4545
test.done();
46-
},
46+
},*/
4747
},
4848
};
4949
// TODO marshalling

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Binding/Unmarshaller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
5656
var result = null;
5757
// Issue #70 work in progress here
5858
var xsiTypeInfo = null;
59+
/*
5960
if (context.supportXsiType) {
6061
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
6162
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
6263
{
6364
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
6465
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
6566
}
66-
}
67+
}*/
6768
var name = input.getName();
6869
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
6970
if (Jsonix.Util.Type.exists(typeInfo))

scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Model/ClassInfo.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,14 @@ Jsonix.Model.ClassInfo = Jsonix
171171
// TODO optionally report a validation error that the element is not expected
172172
et = input.skipElement();
173173
}
174-
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE) && Jsonix.Util.Type.exists(this.structure.mixed)) {
175-
// Characters and structure has a mixed property
176-
var mixedPropertyInfo = this.structure.mixed;
177-
this.unmarshalProperty(context, input,
178-
mixedPropertyInfo, result);
174+
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
175+
if (Jsonix.Util.Type.exists(this.structure.mixed))
176+
{
177+
// Characters and structure has a mixed property
178+
var mixedPropertyInfo = this.structure.mixed;
179+
this.unmarshalProperty(context, input,
180+
mixedPropertyInfo, result);
181+
}
179182
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
180183
// Ignore
181184
} else {

0 commit comments

Comments
 (0)