Why can’t binary data be represented directly in XML, for example, by representing it as Unicode byte values? XML elements can carry strings represented as base64. Discuss the advantages or disadvantages of using this method to represent binary data.

What will be an ideal response?


Binary data can’t be represented directly in XML, because somewhere the embedded binary data will include the representation of a special character such as '<' or '>'.

Even if binary is represented as CDATA, it might include the terminator for CDATA: ']]'. Binary data can be encoded in base64 and represented in XML as a string.
Base64 encoding takes three bytes, each consisting of eight bits, and represents them as four printable characters in the ASCII standard (padding when necessary).
Thus a disadvantage in using base64 is that the quantity of data is increased by a factor of 4/3 and the translation process at both ends can take time. In addition, the encoded value isn’t really a string and in some cases may be passed on to an application as a string.

The only advantage of base64 is that it can be used when necessary. It is in fact used in XML Security to represent digital signatures and encrypted data. In both cases, the data is enclosed in elements that specify, for example, signature or encrypted data.

Computer Science & Information Technology

You might also like to view...

Within the NTDS folder, which file stores the main Active Directory database?

A. ed.dit B. edb.chk C. ntds.dit D. edbres00001.jrs

Computer Science & Information Technology

C#’s type is capable of holding the value true or false.

a) bool b) int c) if d) logic

Computer Science & Information Technology

Which of the following is not a flow technology?

a. Netflow b. Jflow c. Sflow d. Iflow

Computer Science & Information Technology

Only two test cases are required to completely test a search, a value that is in the array (true) and a value that is not in the array (false).

Answer the following statement true (T) or false (F)

Computer Science & Information Technology