cancel
Showing results for 
Search instead for 
Did you mean: 

XSD

Former Member
0 Kudos

Hi,

There are 2 different xsd's that I need to combine in one xsd.

The only yhing I know about this is that say there are 2 xsd's

XSD1:SOAP header

XSD2:SOAP message

Then the XSD2 should be put into the <body?portion of XSD1

But do need to copy and paste the entire XSD2 in the <body > portion of the XSD1 or only some portion should be there?

Please help me.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>But do need to copy and paste the entire XSD2 in the <body > portion of the XSD1 or only some portion should be there?

> Please help me.

If the two XSD's are referencing different target namespace, then we need to use import tag. Whereas if the two are referencing same target namespace then use include tag. This way you can include one of other and no need to copy the entire schema

Refer heterogeneous(diff target namespaces) and homogenous(same target namespace) examples

http://www.xfront.com/ZeroOneOrManyNamespaces.html

Former Member
0 Kudos

Hi Baskar,

If the two XSD's are referencing different target namespace, then we need to use import tag. Whereas if the two are referencing same target namespace then use include tag. This way you can include one of other and no need to copy the entire schema

I guess the target namespace is the url mentioned for the tag target namespace at the start of the coding,right?

If so,then it is not matching for both the xsd's.

How can I proceed?

Thanks in advace

former_member854360
Active Contributor
0 Kudos

Hi ,

in that case use <xsd:import schemaLocation="../common.xsd" />.

Former Member
0 Kudos

Hi Debashish,

Thanks for the quick reply.

There is already one tag as <xs:schema xmlns:xs="http:/.....

Do I need to keep it as it is or need to replace it with <xsd:import schemaLocation="../common.xsd" />. ?

Also,where do I need to put <xsd:import schemaLocation="../common.xsd" />.?

After doing that which portion of the second xsd is supposed to be added to the first xsd?

If the target namespaces are same,what should be done?

Thanks in advacne

Edited by: Shweta Kullkarni on Aug 1, 2011 8:29 AM

former_member854360
Active Contributor
0 Kudos

Hi ,

You dont need to mixed up both the XSDs,

create 2 external definan with 2 XSD

then in first xsd write the import tag where you want to see your second XSD structure.

it will automatically refer your second XSD

Refer this for an import example

http://www.datypic.com/books/defxmlschema/chapter03.html

Former Member
0 Kudos

Hi Debashish,

You dont need to mixed up both the XSDs,

create 2 external definan with 2 XSD

then in first xsd write the import tag where you want to see your second XSD structure.

it will automatically refer your second XSD
Refer this for an import example

This is applicable if the 2 xsd's refer the 2 different target namepaces,right?

What if the 2 xsd's refer the same target namespaces?

Thanks in advace

former_member854360
Active Contributor
0 Kudos

Hi then you can use <xs:include schemaLocation="chapter04ord2.xsd"/>

See example

Schema Document 1 (chapter04ord1.xsd) 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://example.org/ord"
            xmlns="http://example.org/ord"
            xmlns:prod="http://example.org/prod">

  <xs:include schemaLocation="chapter04ord2.xsd"/>
  <xs:include schemaLocation="chapter04cust.xsd"/>
  <xs:import namespace="http://example.org/prod"
                 schemaLocation="chapter04prod.xsd"/>

  <xs:element name="order" type="OrderType"/>
  <xs:complexType name="OrderType">
    <xs:sequence>
      <xs:element name="number" type="OrderNumType"/>
      <xs:element name="customer" type="CustomerType"/>
      <xs:element name="items" type="prod:ItemsType"/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>Schema Document 2 (chapter04ord2.xsd) 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns="http://example.org/ord"
            targetNamespace="http://example.org/ord">

  <xs:simpleType name="OrderNumType">
    <xs:restriction base="xs:string"/>
  </xs:simpleType>

</xs:schema>

http://www.datypic.com/books/defxmlschema/chapter04.html

Also please see the last paragrapg of the below help doc.

http://help.sap.com/saphelp_nwesrce/helpdata/en/26/9e97b0f525d743882936c2d6f375c7/content.htm

Former Member
0 Kudos

Hi Debashish,

Thanks for the quick reply.

Schema Document 1 (chapter04ord1.xsd)

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

targetNamespace="http://example.org/ord"

xmlns="http://example.org/ord"

xmlns:prod="http://example.org/prod">

<xs:include schemaLocation="chapter04ord2.xsd"/>

<xs:include schemaLocation="chapter04cust.xsd"/>

<xs:import namespace="http://example.org/prod"

schemaLocation="chapter04prod.xsd"/>

<xs:element name="order" type="OrderType"/>

<xs:complexType name="OrderType">

<xs:sequence>

<xs:element name="number" type="OrderNumType"/>

<xs:element name="customer" type="CustomerType"/>

<xs:element name="items" type="prod:ItemsType"/>

</xs:sequence>

</xs:complexType>

</xs:schema>Schema Document 2 (chapter04ord2.xsd)

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"

xmlns="http://example.org/ord"

targetNamespace="http://example.org/ord">

<xs:simpleType name="OrderNumType">

<xs:restriction base="xs:string"/>

</xs:simpleType>

</xs:schema>

can you please expalin a bit ? I am confused as whch xsd is added to which xsd along with where exactly is is added and is the output as xsd 1 and xsd2 afer adding the 2 xsd's?

Thanks in advance

former_member854360
Active Contributor
0 Kudos

Hi,

in Schema Document 1 (chapter04ord1.xsd) we have added chapter04ord2.xsd by using include

<xs:include schemaLocation="chapter04ord2.xsd"/>

Former Member
0 Kudos

Hi Debashish,

Thanks for the quick reply.

in Schema Document 1 (chapter04ord1.xsd) we have added chapter04ord2.xsd by using include

<xs:include schemaLocation="chapter04ord2.xsd"/>

Means,only include statement should be added and the path of the xsd like c:/something\something.... is not needed?

And the inclu de should be put at the place in the xsd where it is supposed to be added,right?

I tried to copy and paste the scema from the referece xsd as well along with mentioning its path with and without the complete path.

I did these thing s but the added xsd/the noded in it do not appear when I use it in PI.

Please help me

Thanks in advance

former_member854360
Active Contributor
0 Kudos

Hi,

Only include state is enough.

path name you need to provide as path=../common.xsd

and you need to create another extternal defination named as common.xsd. also dont forget to enter name as common.xsd in source textbox of external defination GUI

Former Member
0 Kudos

Hi Debashish,

The 2 xsd are already created as external definition as xsd1 xsd2.

I need to merger xsd2 into xsd1 so I mentioned its path as

<xs:include schemaLocation="C:\...\xsd2.xsd"/>

in the xsd1

Also,I mentioned the source as xsd2 whose path is mentioned in the include statement in the GUI of the external defintion

As both xsds are already existing in the PI as external defeinition ,do I need to create those xsds again?

Please help me.

I need to use only some part of the xsd2 in the xsd1 so can I use that part in the body portion of the xsd1?

If so where and how?

Its like this

<xs:element name="send" type="send"/>

and in the data group decalration it is

<xs:complexType name="sendData">

<xs:sequence>

<xs:element name="Request" type="Interface">

<xs:annotation>

<xs:description>description</xs:description>

</xs:annotation>

</xs:element>

</xs:sequence>

</xs:complexType>

How and where can I use it in xsd1 ?

Thanks in advance.

former_member854360
Active Contributor
0 Kudos

Hi,

Modify your include <xs:include schemaLocation="..\xsd2.xsd"/> dont put C:/

and in second XSD source put xsd2.xsd only .

and First try to add the total XSD and see whether it is displaying properly or not in PI

Former Member
0 Kudos

Hi Debashish,

I di the following things

1.Included the xsd2 as<xs:include schemaLocation="..\xsd2.xsd"/>

2.Modified the external definition xsd1 with no souece in the GUI of external definition and mentioned the included xsd as xsd2.xsd

3.In the source of xsd2 I did not mention anything.

But when I created the external definition in PI I got parsing error mentioning unble to upload the wsdl ,somrthing like that though I uploaded it as xsd.

Please help me.

Thanks in advance

former_member854360
Active Contributor
0 Kudos

doo the following ........

Open the external defination of XSD2

you will find two option.

one is file -


>where you have selected the XSD from your computer

Below of File another option is SOURCE. here put the same name which you have mentioned in the XSD1 include statement.

If you have entered <xs:include schemaLocation="../XSD2.xsd"/> then in source text box of XSD2 external defination mentioned XSD2.xsd

Former Member
0 Kudos

Hi Debashish,

I did the following

1.Mentioned the xsd2 in the xsd1 in the include tag

2.Mentioned the source as xsd2 in external definition xsd2

3.Tried to get the nmodified xsd1 in PI

But it got the sd error

Then I tried with the import tag as it was mentioning the different namespace but did not get what to mention in the url and the xsd part of teh import tag

Please help me

Thanks in advacne

former_member854360
Active Contributor
0 Kudos

Can you please post the two XSDs.........i will try to give you a solution.

Answers (2)

Answers (2)

Former Member
0 Kudos

answered

former_member854360
Active Contributor
0 Kudos

Hi,

In your one XSD refer the other one dont need to copy paste.

<xsd:include schemaLocation="pathToFile">

OR

<xsd:import namespace="namespace" schemaLocation="pathToFile">

create two externel defination.

refer the below document Sources and References to External Documents section

http://help.sap.com/saphelp_nwesrce/helpdata/en/26/9e97b0f525d743882936c2d6f375c7/content.htm

Former Member
0 Kudos

Hi Debashish and Baskar,

Thanks for the quick replies.

<xsd:include schemaLocation="pathToFile">

The path can be local drive also or it should be some specific caonvention?If so what should it be?

Thanks in advance

former_member854360
Active Contributor
0 Kudos

Hi ,

please refer the below documents Sources and References to External Documents section

A referencing XSD document contains the following <xsd:import schemaLocation="../common.xsd" />. After this document has been imported, the External References tab page specifies that a second external definition with the source ../common.xsd must be referenced to be able to follow the reference. The reference can be followed if you create a second external definition in the same namespace for the file common.xsd, then import the file using this external definition, and finally enter the string ../common.xsd as the source of this external definition. The editor displays the referenced external definition on the External References tab page for the referencing external definition.

http://help.sap.com/saphelp_nwesrce/helpdata/en/26/9e97b0f525d743882936c2d6f375c7/content.htm

it will be completely clear to you. It is not the local drive

it will be something like

<xsd:import schemaLocation="../common.xsd" />.

in your common.xsd external defination you need to put common.xsd in source text box