简体   繁体   English

哪个是更好的 XML 属性:base=64 或 encoding=base64

[英]Which is a better XML attribute: base=64 or encoding=base64

I am designing an XML and wish to allow binary data to be encoded as either base16 or base64.我正在设计一个 XML 并希望允许将二进制数据编码为 base16 或 base64。 The default will be base16.默认值为base16。

For specifying base64, I wish to have an attribute.为了指定 base64,我希望有一个属性。 My two options are:我的两个选择是:

<foo encoding='base64'>TqpuiunH0mEWcSkYSINkTQffuny=</foo>

and:和:

<foo base='64'>TqpuiunH0mEWcSkYSINkTQffuny=</foo>

I think that the first is more descriptive but suspect that the second might be better.我认为第一个更具描述性,但怀疑第二个可能更好。 I'm looking for people's reactions.我正在寻找人们的反应。

Thanks.谢谢。

Seeing as base64 is an encoding, the more semantic markup would be encoding="base64" .看到base64是一种编码,更多的语义标记将是encoding="base64"

People seeing base may think about a decimal base or binary, for example, which I don't believe is what you would want a reader to think.例如,看到base的人可能会想到十进制基数或二进制数,我不相信这是您希望读者想到的。

Depends what the other options are.取决于其他选项是什么。 If the other options are base="2", base="10", or base="32" then I would use base="64".如果其他选项是 base="2"、base="10" 或 base="32",那么我会使用 base="64"。 If the other options are encoding="hexBinary" and encoding="ebcdic" then I would use encoding="base64".如果其他选项是 encoding="hexBinary" 和 encoding="ebcdic",那么我将使用 encoding="base64"。 I don't think you can decide the best representation for an attribute when you only know one of its possible values.当您只知道属性的一个可能值时,我认为您无法确定属性的最佳表示形式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM