IBM Support

Resolution of the validation error when a schema specifies multiple imports with different schemaLocation and same namespace

Troubleshooting


Problem

In Rational® Application Developer (RAD) version 6.x, if an XML Schema specifies multiple imports with the same namespace and different []schemaLocation[] values, by default only the first import is processed. Any references to types defined in the other imported schemas will therefore cause validation errors that look like: []src-resolve: Cannot resolve the name 'xxxx' to a(n) 'element declaration' component.[]

Cause

To see how to reproduce this problem, you can proceed as follows:

  1. Create a new Simple Project
  2. Create two XML Schemas with the same target namespace, but defining different elements, as in the following examples:

    Address.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="
    http://www.w3.org/2001/XMLSchema"    targetNamespace="http://www.example.org/common" xmlns:tns="http://www.example.org/common">
    <element name="Address" type="string"></element>
    </schema>


    Customer.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="
    http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/common" xmlns:tns="http://www.example.org/common">
    <element name="CustomerName" type="string"></element></schema>
  3. Create a third schema having a different target namespace, and importing the previous two schemas, as in the following example:

    Order.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <schema xmlns="
    http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Order" xmlns:tns="http://www.example.org/Order" xmlns:pref="http://www.example.org/common">
    <import namespace="
    http://www.example.org/common" schemaLocation="Address.xsd"></import>
    <import namespace="
    http://www.example.org/common" schemaLocation="Customer.xsd"></import>
    <element name="Order"><complexType>
    <sequence><element ref="pref:CustomerName"></element><element ref="pref:Address"></element></sequence></complexType></element></schema>

  4. Validate the third schema, Order.xsd, and you will get the error:
    src-resolve: Cannot resolve the name 'pref:CustomerName' to a(n) 'element declaration' component.

    By extension, any WSDL referring this type of XML Schema is invalid. This defect is tracked as RATLC00475388

Resolving The Problem

The resolution of this problem was introduced in RAD version 6.0.1.1. However, in order to benefit from the change, upgrading to 6.0.1.1 is not sufficient. You must also add a Java™ Virtual Machine (JVM) argument before starting the tool. In order to do so, proceed as follows, after closing the Software Development Platform:

  1. Locate the file rationalsdp.ini, which by default is in:
    C:\Program Files\IBM\Rational\SDP\6.0
  2. Make a backup copy of this file, then open the original file with a text editor.
  3. Locate the line that states:
    ;Add other individual VMArgs
  4. Add the following line just below it:
    VMArgs=-Djava.endorsed.dirs="{sdp.home}\rwd\eclipse\plugins\com.ibm.etools.validation.xmltools_6.0.101.002\jars"

    where typically:

    {sdp.home}=C:\Program Files\IBM\Rational\SDP\6.0
  5. Save rationalsdp.ini and start the Software Development Platform.
  6. Validate the .xsd file: no error should be reported.
  7. WSDL files referencing this schema file should now also validate without error.

DISCLAIMER
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

[{"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"XML Development","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"6.0;6.0.0.1;6.0.1.0;6.0.1.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSJM4G","label":"Rational Web Developer for WebSphere Software"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"XML Development","Platform":[{"code":"PF033","label":"Windows"},{"code":"PF016","label":"Linux"}],"Version":"6.0;6.0.0.1;6.0.1.0;6.0.1.1","Edition":"","Line of Business":{"code":"","label":""}},{"Product":{"code":"SSYK2S","label":"Rational Software Architect Designer"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"XML Development","Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"6.0;6.0.0.1;6.0.1.0;6.0.1.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
10 September 2020

UID

swg21227348