更新时间:2023-09-11 17:57:10
blockquote"元素好像没有定义为全局元素,所以不能直接引用.如果您查看 xhtml 架构的子部分 http://www.w3.org/MarkUp/SCHEMA/xhtml11-model-1.xsd,你可以注意到它的类型是xhtml.blockquote.type
.
It seems that the "blockquote" element is not defined as global element, thus you can not refer to it directly.
If you have a look in the sub part of the xhtml schema http://www.w3.org/MarkUp/SCHEMA/xhtml11-model-1.xsd, you can notice that its type is xhtml.blockquote.type
.
因此,一种解决方法是像这样声明您的块引用:
So a workaround would be to declare your blockquote like so :
<xs:schema xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="http://www.w3.org/MarkUp/Schema/xhtml11.xsd"/>
<xs:element name="foo">
<xs:complexType>
<xs:sequence>
<xs:element name="blockquote" type="html:xhtml.blockquote.type" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
连同这个有效的 XML 实例:
along with this valid XML instance:
<?xml version="1.0"?>
<foo xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd">
<blockquote><html:p>quick brown fox jumped over the lazy dog.</html:p></blockquote>
</foo>
您会注意到 blockquote 元素没有绑定到 html 命名空间.由于您导入了其他命名空间的元素,我认为将默认目标命名空间设置为您自己的元素也是一种更好的做法.
You will notice that the blockquote element is not bound to the html namespace. Since you import other namespace's elements, I think also it would be a better practice to set a default target namespace to your own elements.