Hi David, On 26/12/2012 4:22 AM, David Brossard wrote: Hi Steven, I've been doing a bit of thinking around the way one should infer a datatype. If we get "3", according to the spec, as it stands today, it should be treated as a string since "3" is a javascript string. If we get 3, according to the spec, as it stands today, it should be treated as an integer... If we get 3.12, we should get a double. The number range in javscript is defined by ECMA - there's a good article here:
http://www.hunlock.com/blogs/The_Complete_Javascript_Number_Reference That said, what matters most of course is the XML definition of #integer and #double since it's what XACML uses. Integer is defined here:
http://www.w3.org/TR/xmlschema-2/#integer double is defined here:
http://www.w3.org/TR/xmlschema-2/#double In what you wrote, you start from the Javscript / JSON definition. I'd rather start from the XML definition of the numbers since this is what is expected by the XACML standard. I agree. The reference to Javascript here is misleading. How Javascript handles numbers is not relevant. Does that make more sense? I would need to rephrase the profile text to the following: JavaScript ”Number” with no fractional portion and within the integer range defined in the XML schema at
http://www.w3.org/TR/xmlschema-2/#integer I think you should not mention Javascript at all here. Call it a JSON number instead. You should also strike out the "within the integer range defined ...". XML Schema doesn't put an upper limit on the size of an integer (though it permits implementations to do so). If an integer is too big for an implementation, then it should fail rather than inferring a value of the double data-type. The column named "Javascript data-type" isn't appropriate, but I haven't been able to come up with a more suitable name. I suggest you remove that column and explain the data-type inference in prose, e.g.: If the DataType property is absent and the JSON value is a string, then the DataType is assumed to be
http://www.w3.org/2001/XMLSchema#string ; otherwise, if the JSON value is true or false, then the DataType is assumed to be
http://www.w3.org/2001/XMLSchema#boolean ; otherwise, if the JSON value is a number without a decimal point or exponent, then the DataType is assumed to be
http://www.w3.org/2001/XMLSchema#integer ; otherwise, if the JSON value is a number, then the DataType is assumed to be
http://www.w3.org/2001/XMLSchema#double ; otherwise, it is an error to omit the DataType property. Or you could phrase it in terms of what the sender produces, e.g.: The DataType property MAY be omitted if the data-type is
http://www.w3.org/2001/XMLSchema#string ,
http://www.w3.org/2001/XMLSchema#boolean or
http://www.w3.org/2001/XMLSchema#integer , or if the data-type is
http://www.w3.org/2001/XMLSchema#double and the JSON number representation of the XACML attribute value contains a decimal point or exponent. In either case it wouldn't hurt to add a column describing the JSON representation of values of the specified data-type; either string, true/false or number. In the case of integer, a number without a decimal point or exponent. Regards, Steven Happy holidays! David. On Tue, Dec 11, 2012 at 12:22 AM, Steven Legg <
steven.legg@viewds.com < mailto:
steven.legg@viewds.com >> wrote: Hi David, I'm not sure how to interpret this description of values of the integer data-type in section 3.4.1 of the JSON profile: JavaScript ”Number” with no fractional portion and within integer range By referencing JavaScript it seems to be suggesting that a JSON number should be parsed as a double and treated as an integer if that double value is a whole number in the range of a 53-bit integer value. If that is the case, then 1.23e3 is an integer value and 9223372036854775807 is a double value. Can you clarify what you intended ? Regards, Steven -- David Brossard, M.Eng, SCEA, CSTP Product Manager +46(0)760 25 85 75 Axiomatics AB Skeppsbron 40 S-111 30 Stockholm, Sweden
http://www.linkedin.com/companies/536082 http://www.axiomatics.com http://twitter.com/axiomatics