Book a Demo

Author Topic: XSD import does not support include?  (Read 4672 times)

Carsten Weise

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
XSD import does not support include?
« on: December 06, 2012, 03:29:48 am »
Just started using EA with XSD. I have some schemas I wanted to import. It's a bunch of XSD files where some have type definitions that are included in others.

However, the import does not treat the included types as I wished, i.e. I cannot see the the tyoe of certain elements. This will work if instead of the includes I defined the types in the same file.

Is this a bug, or am I missing something?

Inlined are three files as a minimal example to reproduce the behavior: import myFormat.xsd to see how it should _not_ work (the elements do not have their types associated), import complete.xsd to see how it works.

Thanks for helping me understand what I should do differently.

Carsten

myFormat.xsd:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:include schemaLocation="types.xsd"/>
      <!--Test-Management-->
      <!--==== Service Definitions ====-->
      <xs:element name="TestManagement" type="StatusInStructure"/>
      <xs:element name="TestManagementReturn" type="StatusOutStructure"/>
</xs:schema>

types.xsd:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:complexType name="StatusInStructure">
            <xs:sequence>
                  <xs:element name="count" type="xs:int"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="StatusOutStructure">
            <xs:sequence>
                  <xs:element name="TimeStamp" type="xs:dateTime"/>
                  <xs:element name="state" type="xs:int"/>
            </xs:sequence>
      </xs:complexType>
</xs:schema>

complete.xsd:
Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:include schemaLocation="types.xsd"/>
      <!-- Types -->
      <xs:complexType name="StatusInStructure">
            <xs:sequence>
                  <xs:element name="count" type="xs:int"/>
            </xs:sequence>
      </xs:complexType>
      <xs:complexType name="StatusOutStructure">
            <xs:sequence>
                  <xs:element name="TimeStamp" type="xs:dateTime"/>
                  <xs:element name="state" type="xs:int"/>
            </xs:sequence>
      </xs:complexType>
      <!--==== Service Definitions ====-->
      <xs:element name="TestManagement" type="StatusInStructure"/>
      <xs:element name="TestManagementReturn" type="StatusOutStructure"/>
</xs:schema>

g.makulik

  • EA User
  • **
  • Posts: 355
  • Karma: +0/-0
    • View Profile
Re: XSD import does not support include?
« Reply #1 on: December 06, 2012, 06:37:25 am »
If this is proved to be right, you might use a XSLT transform prior importing your XSD-schema files as workaround.

HTH
Günther
Using EA9.3, UML2.3, C++, linux, my brain, http://makulik.github.com/sttcl/