Symptom

unable to validate configuration XML files, schema won't load

ERROR Message

Your XML editor or validation tool reports that it's unable to load schemas from a schema location like `xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/displayGroups.xsd"`

Solution

Delay your work and try again a bit later, or temporarily refer to local copies of the schema (see below)

The server serving the schema from a location like http://fews.wldelft.nl/schemas/version1.0/displayGroups.xsd may be temporarily unavailable, specifically during "patch Tuesday" (typically during a CET night on the first Tuesday of the month). Trying again after 30-60 minutes may resolve the issue.

If the work cannot wait, here's a number of ways of temporarily referring to local copies of the schema, for example for `xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/displayGroups.xsd"`:

  • Set up an "XML Catalog". This is a file that will tell your xml validator (remainder of this suggestion assumes you're using xmlspy) to point to a local file if it encounters a reference to a remote file. In other words, when xmlspy reads "http://fews.wldelft.nl/schemas/version1.0/gridDisplay.xsd", it will actually validate against a locally stored gridDisplay.xsd, regardless of whether the server is online or not.
    1. Ensure that the .xsd files are available locally. One way to do this is to extract the files from (Delft-FEWS) bin/Delft_FEWS_schemas.jar to c:\delft-fews\_xsd (note: from Total Commander, the .jar may be opened using ctrl-pagedown)

    2. Create a bespoke catalog.xml file that contains the mapping; an example is included as attachment to this page. You may store this in your xmlspy program folder, or in xmlspy's 'appdata' (e.g., d:\toom\Documents\Altova\XMLSpy2009\, noting that this location may vary between operating systems and versions of xmlspy).

    3. In c:\Program Files\Altova\XMLSpy2015\RootCatalog.xml (or equivalent as per your xmlspy version), add a nextCatalog element that refers to the file you created in step (2): <nextCatalog catalog="DelftFEWS_catalog.xml"/>

    4. Re-start xmlspy

    5. Test by validating a Delft-FEWS configuration file (make sure that your xmlspy instance cannot access the server, for example by setting your laptop to Flight Mode).

    6. When you are again able to validate against the server schema online, set this additional <nextCatalog> within comments (<!-- -->), to check against the latest and greatest on the server.

      Advantage: you can validate against locally stored schemas without having to make changes to the .xml files you are validating.
      Disadvantage: you'll have to ensure that the set of local .xsd files remains up to date (or change the RootCatalog.xml file as needed)


      Additional information on XML catalogs may be found here and here.

  • Open `.\bin\Delft_FEWS_schemas.jar` (with a .zip file manager such as 7-Zip, or using ctrl-pagedown from within Total Commander) and put the schemas in a convenient local location (for example `C:\Temp\FEWS_schemas`) and change the reference to:
    • xsi:schemaLocation="http://www.wldelft.nl/fews file:///C:/Temp/FEWS_schemas/displayGroups.xsd"

      Advantage: may be the least complicated solution for some.
      Disadvantage: the changes to the schemalocation attributes need to be reverted later; some temporary files need to be created and cleaned up later.

  • Alternatively, refer directly to the schema in the jar, in place. For example, if the `Delft_FEWS_schemas.jar` is in `C:\FEWS\bin`:
    • xsi:schemaLocation="http://www.wldelft.nl/fews jar:file:/C:/FEWS/bin/Delft_FEWS_schemas.jar!/displayGroups.xsd"

      Advantage: no temporary files have to be created.
      Disadvantage: the changes to the `schemalocation` attributes need to be reverted later; it can be somewhat cumbersome to find the right XSD in the .jar file.

  • Or, if you have Python installed (or some other tool that allows a simple http server to be started) on a system other than Windows:
    • Unpack `./bin/Delft_FEWS_schemas.jar` to a folder, like in the first option.
    • Open a command prompt in that folder.
    • Run this command:
      • python -m http.server 80
        (Python 3.x)
    • Using a text editor, open `/etc/hosts`
    • Add the following line:
      • 127.0.0.1 fews.wldelft.nl

      NOTE: this blocks current and future access to the actual server at `fews.wldelft.nl` for all users on this machine, until the line added to the `hosts` file has been removed again; make absolutely certain this is not an issue.

      Advantage: all XML can be edited without changing the schemalocation attributes. This makes it a useful solution for changes to configurations on machines not connected to the internet as well.
      Disadvantage: the change to the network is rather radical and needs to be reverted later; some temporary files need to be created and cleaned up later; only works on non-Windows systems, due to limitations on using port 80.

 

  • No labels