XML Schema. Base64binary type vs String type XML Schema. Base64binary type vs String type xml xml

XML Schema. Base64binary type vs String type


There definitely is a difference between base64Binary and string in XSD:


If I understand the specs correctly, there is a semantic difference.

A base64Binary element contains arbitrary, binary data that has been encoded as base64, which makes it basically a string (or at least string-compatible).

On the other hand, strings contain printable characters, which (usually) make up words and sentences (natural language). They cannot contain arbitrary (binary) data, because certain characters aren't allowed.

You can use base64Binary to indicate that the decoded data is not suitable for human consumption, where as string is readable/printable.