Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 这个dtd适合xml文件吗?_Php_Xml_Xsd_Dtd - Fatal编程技术网

Php 这个dtd适合xml文件吗?

Php 这个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文件:

data_out.xml

<?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:对不起,忘记了
+