Re: [xml] Binary data in ATTRIBUTE



Bipin Mistry wrote:
seems that some thing has messed up my example as it was XML kind blocks.

"some thing"= a mail client set up to send HTML mails instead of plain
text, which is something to avoid in the first place.

can I get infor about how to put Binary data in Attribute value.

I have come accross many functions in the xmlorg which deals with binary
data, but all of them are used to write data in COMMENT / CDATA part not
the ATTRIB part.

Most typically, you would encode the data using base64 and put that in
the attribute.  As Daniel says this tends to indicate a very broken design.

So while

<node attr="binary-data-in-base-64"/>

is possible,

<node>
  <attr encoding="base64">binary-data-in-base-64</attr>
  <other-attr>raw-binary-data-with-entities-as-needed</other-attr>
</node>

is a much better design. Attributes are intended for _attributes_, not
data (if a class in your program has 'foo' as a member, then an XML
representation should typically have 'foo' as a sub-element and not an
attribute).




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]