Convention for Deserializing Empty Base64Binary encoded elements

Is there a convention for deserializing empty xml elements which are base64Binary encoded?

For example    '<tst:Base64Test  xmlns:tst="Test"></tst:Base64Test>', where Base64Test is defined in the following schema:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"
&#9;xmlns:tst="Test"
&#9;targetNamespace="Test">
&#9;
&#9;<xs:element name="Base64Test" type="xs:base64Binary"  />
&#9;&#9;
&#9;</xs:schema>

An empty string is what I am finding in discussions on internet forums.  Is Null also considered appropriate?
vas85Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
In XML Schema - Datatypes (3.2.16 base64Binary), the datatype is defined as...
The ·value space· of base64Binary is the set of finite-length sequences of binary octets
therefore the empty element would represent the "zero-length sequence of binary octets".

I am assuming from one of the topic areas that you have posted this question under, you are talking about .NET (although the same applies to Java or many other language). So, I think what we are talking about here is a byte array of zero length.
An empty string is what I am finding in discussions on internet forums.  Is Null also considered appropriate?
This would be different to an empty string because we are talking about binary octets aka bytes here and not strings. Also, a null is different to an empty byte array.

For example, it should deserialise into the equivalent of this...
byte[] Base64Test = new byte[0];

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
In a loosely typed language like PHP, the "falsy" values would apply to this data.  Examples include FALSE, zero, NULL, an empty array or a string of zero length.
http://php.net/manual/en/types.comparisons.php
0
vas85Author Commented:
Thanks for your input.  I think we will proceed with an implementation which returns a ByteArray of zero length.
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Your welcome!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.