Domanda

I have four xsd schemas where one use types from another three. I want to unite them in one document but xs:import with specified namesapces doesn't work: xsd.exe writes "Type ... is not declared". How to make links between multiple xsd schemas in one document?

Upd:
I have this http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd
I downloaded them and execute in command prompt

>xsd imslticc_v1p0.xsd imsbasiclti_v1p0.xsd imslticm_v1p0.xsd imslticp_v1p0.xsd /classes

It works great but I need single xsd.

È stato utile?

Soluzione

This is one way to combine your four schemas into one. You will still have to deal with the individual namespaces when validating your instance:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 
    <xs:import schemaLocation="http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd" 
        namespace="http://www.imsglobal.org/xsd/imslticc_v1p0"/>
    <xs:import schemaLocation="http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd"
        namespace="http://www.imsglobal.org/xsd/imsbasiclti_v1p0"/>
    <xs:import schemaLocation="http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd" 
        namespace="http://www.imsglobal.org/xsd/imslticm_v1p0"/>
    <xs:import schemaLocation="http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd" 
        namespace="http://www.imsglobal.org/xsd/imslticp_v1p0"/>
</xs:schema>

This validates this instance successfully:

<lticc:cartridge_basiclti_link xmlns:lticc="http://www.imsglobal.org/xsd/imslticc_v1p0"
    xmlns:basiclti="http://www.imsglobal.org/xsd/imsbasiclti_v1p0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="multi-schema.xsd">
    <basiclti:title></basiclti:title>
    <basiclti:description></basiclti:description>
    <basiclti:custom></basiclti:custom>
    <basiclti:extensions platform="x"></basiclti:extensions>
    <basiclti:launch_url>http://some-url.com</basiclti:launch_url>
    <basiclti:secure_launch_url>https://some-url.com</basiclti:secure_launch_url>
    <basiclti:icon></basiclti:icon>
    <basiclti:secure_icon></basiclti:secure_icon>
    <basiclti:vendor>
        <code xmlns="http://www.imsglobal.org/xsd/imslticp_v1p0">x</code>
        <name xmlns="http://www.imsglobal.org/xsd/imslticp_v1p0"></name>
    </basiclti:vendor>
</lticc:cartridge_basiclti_link>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top