【发布时间】:2009-05-31 16:37:29
【问题描述】:
我正在尝试在 XML 模式中创建一个元素,以便只有标准 (X)HTML 元素可以用作子元素。我试过的是这样的:
<xs:element name="description">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:any namespace="http://www.w3.org/1999/xhtml" />
</xs:sequence>
</xs:complexType>
</xs:element>
当然,这是行不通的,因为下面的 XML 没有明确指定命名空间:
<description>
<p>this is a test</p>
<p>this is a <b>bold</b> test</p>
<h1>Those were the tests</h1>
</description>
我需要在文档中的某处指定命名空间,还是可以在架构中获取?
【问题讨论】:
标签: html xml namespaces xsd