How should I define my XSD to have dynamic types used a elements?



I am defining a XSD schema for the SOAP requests to be sent to a Web Service that accepts requests like these:



<generic.GenericObject.configureInstanceWithResult xmlns="xmlapi_1.0">
[..]
<configInfo>
<lte.Cell>
<actionMask>
<bit>modify</bit>
</actionMask>
<spare1>1</spare1>
</lte.Cell>
</configInfo>
</generic.GenericObject.configureInstanceWithResult>
<generic.GenericObject.configureInstanceWithResult xmlns="xmlapi_1.0">
[...]
<configInfo>
<lte.LteNeighboringCellRelation>
<actionMask>
<bit>modify</bit>
</actionMask>
<cellIndividualOffset>-1</cellIndividualOffset>
</lte.LteNeighboringCellRelation>
</configInfo>
</generic.GenericObject.configureInstanceWithResult>


In order to achieve this result, I have tried with this schema definition:



<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://ift.tt/tphNwY" targetNamespace="xmlapi_1.0" xmlns:tns="xmlapi_1.0" elementFormDefault="qualified">

<complexType name="Generic.GenericObject.configureInstanceWithResult">
<sequence>
[...]
<element name="configInfo" type="tns:ConfigInfo" />
</sequence>
</complexType>

<complexType name="ConfigInfo">
<sequence>
<element name="payload" type="anyType" />
</sequence>
</complexType>

<complexType name="lte.Cell">
<sequence>
<element name="spare" type="string" />
</sequence>
</complexType>

<complexType name="lte.LteNeighboringCellRelation">
<sequence>
<element name="qOffsetCell" type="string" />
<element name="cellIndividualOffset" type="string" />
</sequence>
</complexType>

<element name="generic.GenericObject.configureInstanceWithResult" type="tns:Generic.GenericObject.configureInstanceWithResult" />


But the result I get is this one:



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<generic.GenericObject.configureInstanceWithResult xmlns="xmlapi_1.0">
<configInfo>
<payload xmlns:xsi="http://ift.tt/ra1lAU" xsi:type="lte.Cell">
<spare>-1</spare>
</payload>
</configInfo>
</generic.GenericObject.configureInstanceWithResult>


Do you see any way in which I could have xsi:type="lte.Cell" as <lte.Cell> instead of <payload>?


No comments:

Post a Comment