温馨提示:本文翻译自stackoverflow.com,查看原文请点击:xml - Failed to read schema document [XSD] because
xml xsd xml-validation ofbiz

xml - 无法读取架构文档[XSD],因为

发布于 2020-04-26 18:32:14

我收到以下错误消息:

无法读取架构文档'ofbiz.apache.org/dtds/widget-screen.xsd',因为1)找不到该文档;2)无法读取文件;3)文档的根元素不是<xsd:schema>

我有一个XML文件,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
    <screen name="ShippingAgreement">
        <section>
            <actions>
                <set field="selectedMenuItem" value="facilityShipment"/>
                <set field="selectedSubMenuItem" value="ShippingContract"/>
            </actions>
            <widgets>
                <decorator-screen name="DelysCommonDecorator" location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">

                    </decorator-section>
                </decorator-screen>
            </widgets>
       </section>
    </screen>
</screens>

为什么我不能针对XSD文件http://ofbiz.apache.org/dtds/widget-screen.xsd进行验证

查看更多

提问者
DragonK
被浏览
30
kjhughes 2015-03-25 19:38

我可以从浏览器访问http://ofbiz.apache.org/dtds/widget-screen.xsd假设您也有权访问所指定的XSD xsi:noNamespaceSchemaLocation,请从XML中删除以下行

<!DOCTYPE xml>

并且您的XML将针对给定的XSD有效。