【发布时间】:2010-11-09 21:13:14
【问题描述】:
我想在我的 xml 文件中做这样的事情:
<myfile>
<screen>
<img src="a.jpg"/>
</screen>
</myfile>
我尝试以这种方式制作: XML 文件
<?xml version="1.0" encoding="UTF-8"?>
<myfile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="myfile.xsd">
<screen>
<img src="a.jpg"/>
</screen>
</myfile>
XSD 文件
<?xml version="1.0"?>
<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsd:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml.xsd"/>
<xsd:element name="myfile">
<xsd:element name="screen">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="xhtml:img"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:element>
但火狐没有显示任何错误,但我看不到任何图像:/ 有人可以帮忙吗?
【问题讨论】: