XML文件错误验证

时间:2017-03-23 19:21:08

标签: xml validation dtd

当我放置一个Product Xml Dtd文件进行检查和验证时:https://validator.w3.org/feed/check.cgi我得到了这个答案:

"对不起

此Feed无效。 第3行,第0列:未定义的根元素:catalog"

我在这里放置了产品目录XML DTD代码的一部分,因此有人可以帮助我找出错误的位置以及如何解决它。另一个Validator网站表示,它有一个空白的行#" 1"和列" 1"并且因此无法验证。拜托,我必须做什么?

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE product_catalog SYSTEM "http://www.sitename.com/content/dtd/product_catalog_1_1.dtd">
<catalog>
<product>
<programname>SiteName.com</programname>
<programurl>http://www.sitename.com?aff=lmcom</programurl>
<catalogname>Productfeed Master EN / USD</catalogname>
<lastupdated>2017-03-20 09:01:30.22</lastupdated>
<name>Dolce &amp; Gabbana blouse</name>
<keywords>Dolce &amp; Gabbana, Cotton, Elastane, dark blue</keywords>
<description>Timeless Dolce &amp; Gabbana shirt.</description>
<sku>F-01-Bl-40751</sku>
<manufacturer>Dolce &amp; Gabbana</manufacturer>
<upc>4251259825500</upc>
<currency>USD</currency>
<price>69</price>
<retailprice>249</retailprice>
<buyurl>http://www.sitename.com/click-9XXXXX6-YYYYYYYY?url=http%3A%2F%2Fwww.sitename.com%2Fus%2Ftimeless-dolce-and-gabbana-shirt-5.html</buyurl>
<impressionurl>http://www.ftjcfx.com/image-9XXXXX6-YYYYYYYY</impressionurl>
<imageurl>http://images.sitename.uk/productimages/export_big/40700_1.jpg</imageurl>
<advertisercategory>Women &gt; blouse</advertisercategory>
<instock>yes</instock>
<standardshippingcost>16.57</standardshippingcost>
</product>
<product>
<programname>SiteName.com</programname>
<programurl>http://www.sitename.com?aff=lmcom</programurl>
<catalogname>Productfeed Master EN / USD</catalogname>
<lastupdated>2017-03-20 09:01:30.438</lastupdated>
<name>Carrera sunglasses</name>
<keywords>Carrera, Metal, purple</keywords>
<description>Carrera. 100% Metal.</description>
<sku>U-83-So-43547</sku>
<manufacturer>Carrera</manufacturer>
<upc>4251259925500</upc>
<currency>USD</currency>
<price>59</price>
<retailprice>129</retailprice>
<buyurl>http://www.sitename.net/click-9XXXXX6-YYYYYYYY?url=http%3A%2F%2Fwww.sitename.com%2Fus%2Fcarrera-11.html</buyurl>
<impressionurl>http://www.ftjcfx.com/image-9XXXXX6-YYYYYYYY</impressionurl>
<imageurl>http://images.sitename.uk/productimages/export_big/43701_1.jpg</imageurl>
<advertisercategory>Unisex &gt; sunglasses</advertisercategory>
<instock>yes</instock>
<standardshippingcost>16.57</standardshippingcost>
</product>
</catalog>

1 个答案:

答案 0 :(得分:0)

<!DOCTYPE product_catalog SYSTEM "http://www.sitename.com/content/dtd/product_catalog_1_1.dtd">
<catalog>

DOCTYPE之后出现的名称必须与最外面的元素名称匹配,例如

<!DOCTYPE catalog SYSTEM "http://www.sitename.com/content/dtd/product_catalog_1_1.dtd">
    <catalog>