我目前正在学习 XML,并且已经了解了与多个名称空间一起使用的 XML Schema 的奇妙世界。
我的问题是我应该何时不必声明命名空间前缀。
考虑以下 XML 模式片段:
<A:schema xmlns:A="http://www.w3.org/2001/XMLSchema"
targetNamespace="B"
xmlns:B="B"
elementFormDefault="qualified">
<A:element name="foo">
<complexType> <!-- or A:complexType?-->
<element name="bar" type="B:myType"/> <!-- or A:element?-->
</complexType>
</A:element>
<B:complexType name="myType">
<choice> <!--or B:choice?-->
<element name="baz" type="string"/> <!--or B:element?-->
<element name="bas" type="string"/> <!--or B:element?-->
</choice>
</B:complexType>
</A:schema>
我是否必须在具有命名空间前缀的节点的所有子节点上指定命名空间前缀,或者这是继承的?或者A:complexType
与complexType
它的父节点附加了 A 命名空间前缀时不同?