W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2011

base64Binary lexical/octet length

From: xmlplus custodians <xmlplus.custodians@gmail.com>
Date: Sun, 10 Apr 2011 02:19:31 +0530
Message-ID: <BANLkTimuk5Ca8k9F+RLjzpr982JG+qA=eA@mail.gmail.com>
To: xmlschema-dev@w3.org
Hi

The XSD1.1 DataTypes spec in the base64Binary section gives following
pseudo-code for calculating octet length of a base64Binary encoded string.

---------------------------------------------------------------------------------
1) lex2   := killwhitespace(lexform)    -- remove whitespace characters
2) lex3   := strip_equals(lex2)         -- strip padding characters at end
3) length := floor (length(lex3) * 3 / 4)         -- calculate length
---------------------------------------------------------------------------------


My understanding is that, for a base64Binary encoded string, it's lexical
length would be a multiple of 4 and it's octet length would be a multiple of
3.

As an example if we take a base64Binary encoded string, which doesn't
contain whitespaces or padding chars(=), so that lexform is same as lex3 in
above code. Now let us take a lex3 of length 10 then, according to above
code, the octet length would be 7(not a multiple of 4).
Are octet-lengths which are not multiple of 4, valid in case of base64Binary
encoded string ?

Also, what should be the formulae for calculating lexical-length from the
octet-length of a base64Binary string ?
Should it be something like this:
*
*
*lexical-length := ceil( octet-length*4/3)*

If we take an example with octet-length=10, the lexical-length is not a
multiple of 4.
I am clueless here. Appreciate your help on the same.

-- 
Best Regards,
Satya Prakash Tripathi
Received on Saturday, 9 April 2011 20:49:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 9 April 2011 20:49:59 GMT