Using a local XSD for an external namespace or XSD location
Sometimes an XSD refers to another XSD that is external. Requiring XSD processing to connect across the internet to access that XSD is strongly discouraged. Network connections have low performance and are unreliable in a production system, and the external XSD might not be reachable. A best practice is to copy the XSD locally to the resource tree and specify how to map the external XSD namespace to a local XSD.
In some situations it is common for an XSD to define an external namespace URI without specifying the external download location for an XSD.
In both cases, Gosu provides a registry file, gwxmlmodule.xml, that lets you use a local XSD instead. The file is located in the module.
The base configuration includes multiple gwxmlmodule.xml files located in various modules. The instance is the application-level file. The other instances of the file are for Guidewire internal use only and are not visible in Studio. Their purpose is to remap common W3C XSD files to local locations to avoid unnecessarily connecting to the W3C web site.
See also
Use a local XSD for an external namespace URI or XSD location URL
To remap an external namespace to a local location, edit the gwxmlmodule.xml file.
Procedure
- Download a copy of the target external XSD.
- Place that XSD in the local resources hierarchy.
-
In Studio, open the gwxmlmodule.xml file. The file is located in
the module. Add a
schema-locationselement with anxmlnsattribute that specifies the local resource location. -
Add a child
schemaelement to theschema-locationselement. -
Set the element's
resourcePathattribute to the fully qualified path to the local XSD. You must use a forward slash (/), not a period (.), to indicate any subpackage. -
To direct Gosu to find and remap an external namespace declaration in parsed XSD, set
the
xmlNamespaceattribute to the external XSD namespace URI. The value starts withhttp://so it looks like a quoted URL, but it is actually a unique ID and not a URL address. -
To direct Gosu to find and remap an external XSD download location in parsed XSD, set
the
externalLocationsattribute to the external XSD URL address. This value may also be useful for your own reference, in case you need to download the latest version of the file.
Example
schema-locations and schema elements are defined in the following
example.<!-- XML namespaces and external schema locations can be registered in this file to
remap to local resources.
The remappings are used when either an <xsd:import> is encountered without a
<schemaLocation> element, or when an external schema location is specified. The
"externalLocations" attribute is a space-delimited list of external references to
recognize for a particular schema.
-->
<schema-locations xmlns="http://guidewire.com/xml/module">
<schema xmlNamespace="http://guidewire.com/archiving"
resourcePath="gw/plugin/archiving/archiving.xsd"
externalLocations=""/>
<schema xmlNamespace="http://guidewire.com/importing"
resourcePath="gw/api/importing/importing.xsd"
externalLocations=""/>
</schemalocations>