1

I'm building an application that uses the following schema .xsd header for modelling objects:

<?xml version="1.0" encoding="ISO-8859-1"?>
<schema xmlns:mh="http://www.kith.no/xmlstds/msghead/2006-05-24" xmlns:xsd="http://www.w3.org/2001/XMLSchema.xsd" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="http://www.kith.no/xmlstds/msghead/2006-05-24" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>

I'm able to fetch the third line "import namespace=http://www.w3.org/2000/09/xmldsig# schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd" just fine locally and thus the project builds, but our external build pipeline denies the fetching of this resource due to firewall and the build fails.

As I have the file it needs to fetch (XML sig-core-schema. XSD) available locally in my project structure already, is it possible to use the local instance of this schema but keeping the namespace, and avoid the external fetching altogether? I can't seem to find out how... Thanks for any advice

robinmanz
  • 361
  • 1
  • 5
  • 17

1 Answers1

2

You could use an XML Catalog to define where the schema exists locally.

But if you can't do that then you might simply use any URI, according to the spec of <import> to locate and import that schema.

For example, if your schemas are in the same directory then you could do this:

<import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="./xmldsig-core-schema.xsd"/>
xtratic
  • 4,600
  • 2
  • 14
  • 32
  • Thank you for responding. I'm tempted to go for the last solution, but will this be an issue later when the xml content corresponding to the schema is created and sent to our third party, or is it simply the namespace that is relevant in that regard? – robinmanz Mar 03 '21 at 13:40
  • If this is intended to be a published then I definitely advise using the catalog approach, also if you bundle this schema in an app then **definitely** define the catalog of the app to locate this schema bundled within it. – xtratic Mar 03 '21 at 13:42