Skip to Content
avatar image
Former Member

HELP: Create multi hierarchy XSD schema referencing other multi hierarchy XSDs

Hi Gurus

I have a set of XSDs which are pointing to each other. For the mapping i need to merge XSDs together to make a SOAP call to a webservice provider which expects a certain hierarchy.

XSD1 this is source

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
	xmlns="http://*.*.*.com/*/*/v1/services/create"
	targetNamespace="http://*.*.*.com/*/*/v1/services/create"
	xmlns:epcore="http://*.*.*.com/*/*/v2/components/core"
	xmlns:epident="http://*.*.*.com/*/*/v2/components/identity"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:importnamespace="http://*.*.*.com/*/*/v2/components/core"schemaLocation="coreTypes-2.0.xsd" />
<xsd:import namespace="http://*.*.*.com/*/*/v2/components/identity"
schemaLocation="identityTypes-2.1.xsd" />
	
<xsd:element name="create" type="CreateType"></xsd:element>
<xsd:complexType name="CreateType">
<xsd:sequence>
<xsd:element name="payerId" type="epident:PayerIdType"minOccurs="0" maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="version" type="xsd:decimal" use="required" />
</xsd:complexType>
</xsd:schema>

XSD 2 name address info coming from this one under multi hierarchy

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
	xmlns="http://*.*.*.com/*/*/v2/components/identity"
	targetNamespace="http://*.*.*.com/*/*/v2/components/identity"
	xmlns:epcore="http://*.*.*.com/*/*/v2/components/core"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
	version="2.1">
<xsd:import namespace="http://*.*.*.com/*/*/v2/components/core"
	schemaLocation="coreTypes-2.0.xsd" />

<xsd:complexType name="PayerIdType">
<xsd:sequence>
<xsd:element name="payerIndividualIdentity" type="PayerIndividualIdType"
minOccurs="0" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="PayerIndividualIdType">
<xsd:sequence>
<xsd:element name="name" type="IndividualNameType" minOccurs="1" maxOccurs="1" />
<xsd:element name="address" type="AddressType" minOccurs="0"maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="IndividualNameType">
<xsd:sequence>
<xsd:element name="givenNames" type="GivenNameType"minOccurs="1" maxOccurs="1" />
<xsd:element name="familyName" type="FamilyNameType"minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="GivenNameType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1" />
			<xsd:maxLength value="1024" />
		</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="FamilyNameType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1" />
			<xsd:maxLength value="1024" />
		</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="AddressType">
<xsd:sequence>
<xsd:element name="addressLine1" type="AddressLineType"
minOccurs="1" maxOccurs="1" />
<xsd:element name="city" type="AddressLineType"minOccurs="1" maxOccurs="1" />
<xsd:element name="country" type="epcore:CountryCodeType"
minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>

<xsd:simpleType name="AddressLineType">
		<xsd:restriction base="xsd:string">
			<xsd:minLength value="1" />
			<xsd:maxLength value="254" />
		</xsd:restriction>
	</xsd:simpleType>
</xsd:schema>

Required xml

<ns2:create xmlns:ns2="http://*.*.*.com/*/*/v1/services/createOrUpdateUser" version="1.0" xmlns="http://*.*.*.com/*/*/v2/components/core" xmlns:ns3="http://*.*.*.com/*/*/v2/components/identity">
  <ns2:payerId>
    <ns3:payerIndividualId>
      <ns3:name>
        <ns3:givenNames>Matt</ns3:givenNames>
        <ns3:familyName>Smith</ns3:familyName>
      </ns3:name>
      <ns3:address>
        <ns3:addressLine1>21 New Street</ns3:addressLine1>
        <ns3:city>London</ns3:city>
        <ns3:country>GB</ns3:country>
      </ns3:address>
    </ns3:payerIndividualId>
  </ns2:payerId>
</ns2:create>


Its a multi hierarchy in reference xsd...i dont know how to call this in one xsd to create the out put required.

Appreciate your help!

-

Naina


Add comment
10|10000 characters needed characters exceeded

  • Hi Naina,

    The XSD's you provided are invalid .

    Can you please put the actaully XSD you have . if there is any constraint you can replace the namespace .

    Br,

    Manoj

  • Get RSS Feed

0 Answers