Php 这个dtd适合xml文件吗?
我有一个xml文件: data_out.xmlPhp 这个dtd适合xml文件吗?,php,xml,xsd,dtd,Php,Xml,Xsd,Dtd,我有一个xml文件: data_out.xml <?xml version="1.0" ?> <!DOCTYPE allproperty SYSTEM "data_out.dtd"> <allproperty> <aproperty> <postcode>ha15rs</postcode> <price>250</price> <imagefil
<?xml version="1.0" ?>
<!DOCTYPE allproperty SYSTEM "data_out.dtd">
<allproperty>
<aproperty>
<postcode>ha15rs</postcode>
<price>250</price>
<imagefilename>home2.gif</imagefilename>
<visits>2</visits>
</aproperty>
<aproperty>
<postcode>ha36gs</postcode>
<price>150</price>
<imagefilename>home3.gif</imagefilename>
<visits>1</visits>
</aproperty>
<aproperty>
<postcode>ha27se</postcode>
<price>300</price>
<imagefilename>home4.gif</imagefilename>
<visits>4</visits>
</aproperty>
<aproperty>
<postcode>ha4678</postcode>
<price>200</price>
<imagefilename>home5.gif</imagefilename>
<visits>5</visits>
</aproperty>
</allproperty>
ha15rs
250
home2.gif
2.
ha36gs
150
home3.gif
1.
ha27se
300
home4.gif
4.
ha4678
200
home5.gif
5.
DTD文件
数据输出dtd
<!ELEMENT aproperty (postcode,price,imagefilename,visits)>
<!ELEMENT postcode (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT imagefilename (#PCDATA)>
<!ELEMENT visits (#PCDATA)>
当我检查“是否未声明
allproperty
”时,我不断收到一个错误。您也必须在DTD中正确声明allproperty
<!ELEMENT allproperty (aproperty+)>
<!ELEMENT aproperty (postcode,price,imagefilename,visits)>
<!ELEMENT postcode (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT imagefilename (#PCDATA)>
<!ELEMENT visits (#PCDATA)>
谢谢我这么做了,现在我得到这个元素allproperty内容不符合DTD,期望(属性),得到(属性)
谢谢+1me@getaway:对不起,忘记了+