首页 > 解决方案 > 无法让我的 xml 和 dtd 一起工作,内容中不允许使用 doctype

问题描述

我无法链接 XML 和 DTD,当我验证时,我不断收到一个 DOCTYPE 错误,正如我所说的那样,当我保存为 xml 并将其单击到浏览器中时,它只是空白。

我之前验证了我的 XML,它很好(从那时起已经做了一些更改),但我无法理解为什么 DTD 不能与我的 XML 一起使用。

Validating, trying new doctype commands, researching to find a solution.

header ("Content-Type:text/xml");


<!DOCTYPE   [
<!ELEMENT restaurantdetails (cuisine,name,logo,foodpicture,URL,address,location,takeaway,dinein,ph,openhours,delivery,description)
<!ATTLIST cuisine type CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT logo (#PCDATA)>
<!ELEMENT foodpicture (#PCDATA)>
<!ELEMENT URL (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT location (#PCDATA)>
<!ELEMENT takeaway (#PCDATA)>
<!ELEMENT dinein (#PCDATA)>
<!ELEMENT ph (#PCDATA)>  
]>

<pre>
<restaurantdetails>
    <cuisines> 
        <Asian>
            <b>
            <name>Name: Wok N Roll</name>
            <logo>
                <img src="Graphics/woknroll.png" alt="Stalactites" width="300" height="300">
            </logo>
            <foodpicture>
                <img src="Graphics/wokfood.jpg" alt="Stalactites" width="600" height="400">
            </foodpicture>
            <URL>URL: https://www.stockland.com.au/shopping-centres/centres/stockland-green-hills/stores/wok-n-roll</URL>
            <address>Address: 1 Molly Morgan Drive, Stockland</address>
            <location>Location: East Maitland</location>
            <takeaway>Takeway: Yes</takeaway>
            <dinein>Dine-in: Yes</dinein>
            <ph>Phone: 49336589</ph>
            <openhours>Open Hours:</openhours>
                    <openhoursmonday>Monday=9am- 
530pm</openhoursmonday>
                    <openhourstuesday>Tuesday=9am-530pm</openhourstuesday>
                    <openhourswednesday>Wednesday=9am-530pm</openhourswednesday>
                    <openhoursthursday>Thursday=9am-9pm</openhoursthursday>
                    <openhoursfriday>Friday=9am-530pm</openhoursfriday>
                    <openhourssaturday>Saturday=9am-5pm</openhourssaturday>
                    <openhourssunday>Sunday=10am-4pm</openhourssunday>
            <openhours></openhours>
            <delivery>Delivery: Yes</delivery>
            <minimumspend>Minimum spend for delivery: $34</minimumspend>
            <deliveryfee>Delivery Fee: $10</deliveryfee>
            <description>Description: Wok N Roll offers authentic Chinese food prepared and cooked on site daily. Using the 
            freshest ingredients to create delicious meals available for takeaway or dining in. Served with your choice of 
            noodles or rice a meal from Wok N Roll is a delicious choice for lunch or dinner. Fresh handmade sushi is also          
            available.</description>
            </b>    
    </cuisines>
</restaurantdetails>
</pre>


To be able to open it as an XML and display what is written in the code instead of having to open it as a HTML.

标签: xmlinternalsdtd

解决方案


推荐阅读