Skip to content

Commit

Permalink
Reverted some of the changes prior to the release. Issue #70.
Browse files Browse the repository at this point in the history
  • Loading branch information
highsource committed Apr 5, 2015
1 parent 21baad4 commit 6362e86
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 34 deletions.
16 changes: 10 additions & 6 deletions dist/Jsonix-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -1929,14 +1929,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
var result = null;
// Issue #70 work in progress here
var xsiTypeInfo = null;
/*
if (context.supportXsiType) {
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
{
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
}
}
}*/
var name = input.getName();
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
if (Jsonix.Util.Type.exists(typeInfo))
Expand Down Expand Up @@ -2145,11 +2146,14 @@ Jsonix.Model.ClassInfo = Jsonix
// TODO optionally report a validation error that the element is not expected
et = input.skipElement();
}
} 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)) {
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
if (Jsonix.Util.Type.exists(this.structure.mixed))
{
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
}
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
// Ignore
} else {
Expand Down
25 changes: 11 additions & 14 deletions dist/Jsonix-min.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,15 @@ h(that.unmarshalDocument(b))
var e=null;
d.nextTag();
return this.unmarshalElement(this.context,d)
},unmarshalElement:function(u,r,n){if(r.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next text.")
}var l=null;
var m=null;
if(u.supportXsiType){var t=r.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI,Jsonix.Schema.XSI.TYPE);
if(Jsonix.Util.StringUtils.isNotBlank(t)){var p=Jsonix.Schema.XSD.QName.INSTANCE.parse(t,u,r,n);
m=u.getTypeInfoByTypeNameKey(p.key)
}}var v=r.getName();
var o=m?m:this.getElementTypeInfo(v,u,n);
if(Jsonix.Util.Type.exists(o)){var q=o.unmarshal(u,r,n);
var s=this.convertToElementValue({name:v,value:q},u,r,n);
return s
}else{throw new Error("Element ["+v.key+"] is not known in this context.")
},unmarshalElement:function(q,o,l){if(o.eventType!=1){throw new Error("Parser must be on START_ELEMENT to read next text.")
}var j=null;
var k=null;
var r=o.getName();
var m=k?k:this.getElementTypeInfo(r,q,l);
if(Jsonix.Util.Type.exists(m)){var n=m.unmarshal(q,o,l);
var p=this.convertToElementValue({name:r,value:n},q,o,l);
return p
}else{throw new Error("Element ["+r.key+"] is not known in this context.")
}},getElementTypeInfo:function(f,e,g){var h=e.getElementInfo(f,g);
if(Jsonix.Util.Type.exists(h)){return h.typeInfo
}else{return undefined
Expand Down Expand Up @@ -841,9 +838,9 @@ this.unmarshalProperty(B,w,r,p)
}else{if(Jsonix.Util.Type.exists(this.structure.any)){var s=this.structure.any;
this.unmarshalProperty(B,w,s,p)
}else{v=w.skipElement()
}}}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;
}}}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;
this.unmarshalProperty(B,w,x,p)
}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+"].")
}}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+"].")
}}}v=w.next()
}}else{if(Jsonix.Util.Type.exists(this.structure.value)){var t=this.structure.value;
this.unmarshalProperty(B,w,t,p)
Expand Down
16 changes: 10 additions & 6 deletions nodejs/scripts/jsonix.js
Original file line number Diff line number Diff line change
Expand Up @@ -1929,14 +1929,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
var result = null;
// Issue #70 work in progress here
var xsiTypeInfo = null;
/*
if (context.supportXsiType) {
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
{
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
}
}
}*/
var name = input.getName();
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
if (Jsonix.Util.Type.exists(typeInfo))
Expand Down Expand Up @@ -2145,11 +2146,14 @@ Jsonix.Model.ClassInfo = Jsonix
// TODO optionally report a validation error that the element is not expected
et = input.skipElement();
}
} 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)) {
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
if (Jsonix.Util.Type.exists(this.structure.mixed))
{
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
}
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
// Ignore
} else {
Expand Down
4 changes: 2 additions & 2 deletions nodejs/scripts/tests/GH70/GH70.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
test.equal("GH70.Literal", data.value.TYPE_NAME);
test.equal("test", data.value.value);
test.done();
},
},/*
"ExpressionAsLiteral" : function(test) {
var unmarshaller = context.createUnmarshaller();
var data = unmarshaller.unmarshalString('<Expression xmlns="urn:GH70" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Literal">test</Expression>');
Expand All @@ -43,7 +43,7 @@ module.exports = {
test.equal("GH70.And", data.value.TYPE_NAME);
test.equal(2, data.value.expressions.length);
test.done();
},
},*/
},
};
// TODO marshalling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ Jsonix.Binding.Unmarshaller = Jsonix.Class(Jsonix.Binding.ElementUnmarshaller, {
var result = null;
// Issue #70 work in progress here
var xsiTypeInfo = null;
/*
if (context.supportXsiType) {
var xsiType = input.getAttributeValueNS(Jsonix.Schema.XSI.NAMESPACE_URI, Jsonix.Schema.XSI.TYPE);
if (Jsonix.Util.StringUtils.isNotBlank(xsiType))
{
var xsiTypeName = Jsonix.Schema.XSD.QName.INSTANCE.parse(xsiType, context, input, scope);
xsiTypeInfo = context.getTypeInfoByTypeNameKey(xsiTypeName.key);
}
}
}*/
var name = input.getName();
var typeInfo = xsiTypeInfo ? xsiTypeInfo : this.getElementTypeInfo(name, context, scope);
if (Jsonix.Util.Type.exists(typeInfo))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ Jsonix.Model.ClassInfo = Jsonix
// TODO optionally report a validation error that the element is not expected
et = input.skipElement();
}
} 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)) {
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
} else if ((et === Jsonix.XML.Input.CHARACTERS || et === Jsonix.XML.Input.CDATA || et === Jsonix.XML.Input.ENTITY_REFERENCE)) {
if (Jsonix.Util.Type.exists(this.structure.mixed))
{
// Characters and structure has a mixed property
var mixedPropertyInfo = this.structure.mixed;
this.unmarshalProperty(context, input,
mixedPropertyInfo, result);
}
} else if (et === Jsonix.XML.Input.SPACE || et === Jsonix.XML.Input.COMMENT || et === Jsonix.XML.Input.PROCESSING_INSTRUCTION) {
// Ignore
} else {
Expand Down

0 comments on commit 6362e86

Please sign in to comment.