Warm tip: This article is reproduced from stackoverflow.com, please click
xml xsd xml-validation ofbiz

Failed to read schema document [XSD] because

发布于 2020-04-23 13:21:10

I am getting the following error message:

Failed to read schema document 'ofbiz.apache.org/dtds/widget-screen.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.

I have got a XML file as follows:

<?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>

Why can't I validate it against XSD file http://ofbiz.apache.org/dtds/widget-screen.xsd?

Questioner
DragonK
Viewed
34
kjhughes 2015-03-25 19:38

I am able to access http://ofbiz.apache.org/dtds/widget-screen.xsd from a browser. Assuming that you too have access to the XSD specified by xsi:noNamespaceSchemaLocation, delete the following line from your XML

<!DOCTYPE xml>

and your XML will be valid against the given XSD.