将属性值指定为 CDATA [英] Specifying attribute values as CDATA

查看:26
本文介绍了将属性值指定为 CDATA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以将 XML 属性值指定为 CDATA 吗?如果是 - 相同的架构是什么.如果不是 - 为什么这个限制没有在 XML 中解决?

Can one specify XML attribute values as CDATA ? If yes - what would be the schema for the same. If not - why is this limitation not addressed in XML ?

推荐答案

不,你不能这样做.

在什么构成属性和什么构成子元素之间有一条非常细微的界线(并且有很大的争论).例如,请参见此处.

There's a very fine line (and a very large debate) between what constitutes an attribute and what constitutes a child element. See here for example.

鉴于此,限制"并未在 XML 中解决,因为它不存在.您总是可以将这些数据放入子元素中,实际上我什至会说,如果您甚至必须考虑这一点,元素就是正确的结构.

That given, the "limitation" isn't addressed in XML because it doesn't exist. You always have the ability to put this data in a child element, and in fact I would go so far as to say that if you even have to think about this, an element is the correct structure.

更多阅读材料

这篇关于将属性值指定为 CDATA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆