0

I am a very beginner in GIS and have the following problem I couldn't resolve yet. I have an XSD schema and an XML document I want to validate against the schema. As expected the XML isn't valid yet, the error saying

The content of the element '{http://www.bafg.de/namespace/dwd/2009}GeneralInformation' is with regard to the overarching element '{http://www.opengis.net/gml}featureMember' not valid. Expected: {http://www.opengis.net/gml}_Feature.

Here is my XSD schema:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:dwd="http://www.bafg.de/namespace/dwd/2009" xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.bafg.de/namespace/dwd/2009" elementFormDefault="qualified" version="0.4">
    <import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
    <element name="GeneralInformation" type="dwd:GeneralInformationType" substitutionGroup="gml:_Feature"/>
    <complexType name="GeneralInformationType">
        <complexContent>
            <extension base="gml:AbstractFeatureType">
                <sequence>
                    <element name="ReportType" type="gml:CodeType"/>    
                    <element name="CountryStateCode" type="gml:CodeType"/>
                    <element name="Year" type="gYear"/>
                    <element name="TotalPopulation" type="double"/>
                    <element name="NumberWSZ" type="integer"/>
                    <element name="Groundwater" type="double"/>
                    <element name="Surfacewater" type="double"/>
                    <element name="Inlandwater" type="double"/>
                    <element name="Coastalwater" type="double"/>
                    <element name="Bankfiltrationwater" type="double"/>
                    <element name="ArtificialGrondwaterRecharge" type="double"/>
                    <element name="Rainwater" type="double"/>
                    <element name="Otherwater" type="double"/>
                    <element name="WebsiteAddress" type="anyURI" maxOccurs="unbounded"/>
                    <element name="ResponsibleAuthority" type="string"/>
                    <element name="Name" type="string"/>
                    <element name="Address" type="string"/>
                    <element name="City" type="string" minOccurs="0"/>
                    <element name="Telephone" type="string"/>
                    <element name="Fax" type="string"/>
                    <element name="Email" type="string"/>
                    <element name="NoAnnualMonitoringReport" type="boolean"/>
                </sequence>
            </extension>
        </complexContent>
    </complexType>
    <complexType name="GeneralInformationPropertyType">
        <sequence minOccurs="0">
            <element ref="dwd:GeneralInformation"/>
        </sequence>
        <attributeGroup ref="gml:AssociationAttributeGroup"/>
    </complexType>
</schema>

And here the XML file showing the error (and I am supposed to modify according to the schema):

<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection gml:id="Trinkwaser_NRW.xml" xsi:schemaLocation="http://www.bafg.de/namespace/dwd/2009 Schema.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" xmlns:dwd="http://www.bafg.de/namespace/dwd/2009" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <gml:featureMember>
        <dwd:GeneralInformation gml:id="GeneralInformation_1">
            <dwd:ReportType>DWD_1000</dwd:ReportType>
            <dwd:CountryStateCode>Nordrhein-Westfalen</dwd:CountryStateCode>
            <dwd:Year>2013</dwd:Year>
            <dwd:TotalPopulation>3.4</dwd:TotalPopulation>
            <dwd:NumberWSZ>56</dwd:NumberWSZ>
            <dwd:Groundwater>90</dwd:Groundwater>
            <dwd:Surfacewater>5</dwd:Surfacewater>
            <dwd:Inlandwater>5</dwd:Inlandwater>
            <dwd:Coastalwater>0</dwd:Coastalwater>
            <dwd:Bankfiltrationwater>3</dwd:Bankfiltrationwater>
            <dwd:ArtificialGrondwaterRecharge>0</dwd:ArtificialGrondwaterRecharge>
            <dwd:Rainwater>2</dwd:Rainwater>
            <dwd:Otherwater>0</dwd:Otherwater>
            <dwd:WebsiteAddress>http://www.trinkwasser_nrw.de</dwd:WebsiteAddress>
            <dwd:ResponsibleAuthority>Landesgesundheitsamt NRW</dwd:ResponsibleAuthority>
            <dwd:Address>Musterstraße 1</dwd:Address>
            <dwd:City>12345 Musterstadt</dwd:City>
            <dwd:Telephone>123456</dwd:Telephone>
            <dwd:Fax>654321</dwd:Fax>
            <dwd:Email>[email protected]</dwd:Email>
            <dwd:NoAnnualMonitoringReport>true</dwd:NoAnnualMonitoringReport>
        </dwd:GeneralInformation>
    </gml:featureMember>
</gml:FeatureCollection>

I don't see the problem, since in the schema the substitutiongroup for "gml:_Feature" is given. What do I need to change?

1
  • What software are you using to do your validation
    – nmtoken
    Commented May 24, 2023 at 14:07

1 Answer 1

1

I'm not sure which software you are using to do your validation, but for me the only error is you are missing an <dwd:Name></dwd:Name> element before the <dwd:Address> element.

The following validates using oXygen, I took a copy of your schema called it Schema.xsd, and put it on a local server.

<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection gml:id="Trinkwaser_NRW.xml"
    xsi:schemaLocation="http://www.bafg.de/namespace/dwd/2009 http://localhost/xml/schemas/dwd/Schema.xsd http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"
    xmlns:dwd="http://www.bafg.de/namespace/dwd/2009" xmlns:gml="http://www.opengis.net/gml"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <gml:featureMember>
        <dwd:GeneralInformation gml:id="GeneralInformation_1">
            <dwd:ReportType>DWD_1000</dwd:ReportType>
            <dwd:CountryStateCode>Nordrhein-Westfalen</dwd:CountryStateCode>
            <dwd:Year>2013</dwd:Year>
            <dwd:TotalPopulation>3.4</dwd:TotalPopulation>
            <dwd:NumberWSZ>56</dwd:NumberWSZ>
            <dwd:Groundwater>90</dwd:Groundwater>
            <dwd:Surfacewater>5</dwd:Surfacewater>
            <dwd:Inlandwater>5</dwd:Inlandwater>
            <dwd:Coastalwater>0</dwd:Coastalwater>
            <dwd:Bankfiltrationwater>3</dwd:Bankfiltrationwater>
            <dwd:ArtificialGrondwaterRecharge>0</dwd:ArtificialGrondwaterRecharge>
            <dwd:Rainwater>2</dwd:Rainwater>
            <dwd:Otherwater>0</dwd:Otherwater>
            <dwd:WebsiteAddress>http://www.trinkwasser_nrw.de</dwd:WebsiteAddress>
            <dwd:ResponsibleAuthority>Landesgesundheitsamt NRW</dwd:ResponsibleAuthority>
            <dwd:Name></dwd:Name>
            <dwd:Address>Musterstraße 1</dwd:Address>
            <dwd:City>12345 Musterstadt</dwd:City>
            <dwd:Telephone>123456</dwd:Telephone>
            <dwd:Fax>654321</dwd:Fax>
            <dwd:Email>[email protected]</dwd:Email>
            <dwd:NoAnnualMonitoringReport>true</dwd:NoAnnualMonitoringReport>
        </dwd:GeneralInformation>
    </gml:featureMember>
</gml:FeatureCollection>
1
  • 1
    Many thanks to @nmtoken ! I found out that the error occurred because of a firewall blocking. So the actual error was the missing name as you suggested. thanks a lot! Commented May 25, 2023 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.