你还可以使用 <anyAttribute> 元素制作可扩展的 XML 文档,它与 <any> 的扩展功能类似,只是针对属性进行扩展。
<anyAttribute> 元素使我们有能力通过未被 schema 规定的属性来扩展 XML 文档!
<anyAttribute> 元素使我们有能力通过未被 schema 规定的属性来扩展 XML 文档!
下面的例子是来自名为 "family.xsd" 的 XML schema 的一个片段。它为我们展示了针对 "person" 元素的一个声明。通过使用 <anyAttribute> 元素,我们就可以向 "person" 元素添加任意数量的属性:
现在,我们希望通过 "gender" 属性来扩展 "person" 元素。在这种情况下我们就可以这样做,即使这个 schema 的作者从未声明过任何 "gender" 属性。
请看这个 schema 文件,名为 "attribute.xsd":
下面这个 XML(名为 "Myfamily.xml"),使用了来自不同 schema 的成分,"family.xsd" 和 "attribute.xsd":
上面这个 XML 文件是有效的,这是因为 schema "family.xsd" 允许我们向 "person" 元素添加属性。
<any> 和 <anyAttribute> 均可用于制作可扩展的文档!它们使文档有能力包含未在主 XML schema 中声明过的附加元素。
XSLT xsl:choose 元素XSLTxsl:choose元素与 xsl:when 和 xsl:otherwise 结合使用时,表示多条件选择。 XSLT 元素参考手册定义和...
XML DOM name 属性 DocumentType 对象定义和用法 name 属性返回 DTD 的名称(紧随关键词 DOCTYPE 的名称)。 语法documentObject...
Window resizeTo() 方法 Window 对象定义和用法方法用于把窗口大小调整为指定的宽度和高度。语法window.resizeTo(width,height)...
Screen availHeight 属性 Screen Object定义和用法availHeight 属性声明了显示浏览器的屏幕的可用高度,以像素计。在 Windows 这...
HTML DOM removeAttributeNode() 方法 元素对象实例删除头部元素的属性节点:var n=document.getElementsByTagName(INPUT)[0];va...