how to convert Json array to XSD - json

I am currently mapping Json and XSD.
In Json there is array contains several items with same elements.
the Json array is like:
"Item":[
{
"ItemSequenceNo":0,
"AQuantity":{
"code":"aaa",
"quantity":1
},
"DQuantity":{
"code":"ddd",
"quantity":4
},
"Amount":{
"currencyID":"USD",
"value":111
},
},
{
"ItemSequenceNo":1,
"AQuantity":{
"code":"aaa",
"quantity":4
},
"DQuantity":{
"code":"ddd",
"quantity":9
},
"Amount":{
"currencyID":"USD",
"value":123
},
}
]
I tried to map this Json array with XSD:
<xs:element name="Item">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="50">
<xs:element ref="p:ItemSequenceNo" minOccurs="1" maxOccurs="1"/>
<xs:element ref="p:AQuantity" minOccurs="1" maxOccurs="1"/>
<xs:element ref="p:DQuantity" minOccurs="1" maxOccurs="1"/>
<xs:element ref="p:Amount" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
where the ref is like:
<xs:element name="ItemSequenceNo">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="5"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="AQuantity">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="DQuantity">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="code">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="Amount">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:integer">
<xs:attribute name="CurrencyID">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="0"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
The thing is when I am mapping Json array with XSD, the output XML ordered by array item(elements) like below:
<item>
<ItemSequenceNo >0</ItemSequenceNo>
<ItemSequenceNo >1</ItemSequenceNo>
<AQuantity code="aaa">1</AQuantity>
<AQuantity code="aaa">4</AQuantity>
<DQuantity code="ddd">4</DQuantity>
<DQuantity code="ddd">9</DQuantity>
<Amount CurrencyID="USD">111</Amount>
<Amount CurrencyID="USD">123</Amount>
</item>
while the result I am expecting is two separate blocks:
<item>
<ItemSequenceNo >0</ItemSequenceNo>
<AQuantity code="aaa">1</AQuantity>
<DQuantity code="ddd">4</DQuantity>
<Amount CurrencyID="USD">111</Amount>
</item>
<item>
<ItemSequenceNo >1</ItemSequenceNo>
<AQuantity code="aaa">4</AQuantity>
<DQuantity code="ddd">9</DQuantity>
<Amount CurrencyID="USD">123</Amount>
</item>
Does anyone have any idea on how can I get this? By modifying Json/XSD, or is there any function in MapForce that could achieve this?

You already solved it, as you said in your comment, but for people who are coming here with the same problem, looking for a solution, it would be nice to provide an answer here.
It may be a bit counterintuitive, that in MapForce you don't draw the line from the Item-Array in the JSON input to the Item node in the XML output. If you do so, you'll get the unified output that BOSubuntu has described. Instead, you draw the line from the objects that the array contains (see picture below, line marked in red). This would give the desired output.

Related

Conversion of XML Schema to JSON array list in Biztalk

I have defined a xml scehema below
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.1">
<xs:element name="Root">
<xs:complexType>
<xs:all>
<xs:element name="bblist">
<xs:complexType>
<xs:sequence>
<xs:element name="item" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
I want to generate the Json below using a pipeline.
{
"bblist":
[
"13403"
]
}
but the BizTalk pipeline converts it to
{"bblist": "13403"}
Just wondering if my schema is correct. Am I defining the xsd to generate Json arrays correctly?
There are three issues with your XSD schema
You haven't defined a target Namespace. Which means when it goes through the XML Receive it sets the MessageType to a default set of values which doesn't reference the schema. Which means it might not know which schema to use in the JSON Encoder.
MessageType Root Promoted http://schemas.microsoft.com/BizTalk/2003/system-properties
You have used a <xs:all> rather than a <xs:sequence> in your schema definition. That the JSON Encoder doesn't handle.
If you define your schema as this
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://bblist" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" targetNamespace="http://bblist" vc:minVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" name="bblist">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="item" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
With a payload of
<ns0:Root xmlns:ns0="http://bblist">
<bblist>
<item>item_0</item>
</bblist>
</ns0:Root>
You get a output of
{
"bblist": {
"item": [
"item_0"
]
}
}
This is closer to your expected JSON, with it making an array of the repeating element.
Your structure is incorrect for the JSON you are expecting as you have the repeat on the item and not on the blist.
If you define your schema as
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://bblist" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" targetNamespace="http://bblist" vc:minVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Root">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" name="blist" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XML is
<ns0:Root xmlns:ns0="http://bblist">
<blist>blist_0</blist>
</ns0:Root>
JSON is
{
"blist": [
"blist_0"
]
}

Error at line 2 : no declaration found for element 'xs:schema'

I'm having a real hard time trying to validate my XSD file against my XML file.
My XML validates just fine but when trying to do the same for my XSD file it keeps returning this error:
Error at line 2 : no declaration found for element xs:schema
I'm using XML copy editor but when I use an online validator such as https://www.freeformatter.com/xml-validator-xsd.html there is no issue. I do still want to know why i'm getting this error because I don't see a way to declare "schema" which is root ? or am I mistaken. Both are locally stored on my PC.
Below is the XML
<?xml version="1.0" encoding="UTF-8"?>
<students
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schema.xsd">
<alumno id="001">
<nombre>Samuel</nombre>
<apellido>Van Bladel</apellido>
<email>Samuelvanbladel#gmail.com</email>
<foto>https://google.com</foto>
<expediente>NX0001R</expediente>
<curso>1</curso>
<modulo>
<modulonom>daw1</modulonom>
<nota>10</nota>
<comentario>Muy bien hecho hasta el techo</comentario>
</modulo>
<modulo>
<modulonom>daw2</modulonom>
<nota>10</nota>
<comentario>Muy bien hecho hasta el techo</comentario>
</modulo>
</alumno>
<alumno id="002">
<nombre>Chris</nombre>
<apellido>den oudste</apellido>
<email>chris#gmail.com</email>
<foto>https://google.com</foto>
<expediente>NX0002R</expediente>
<curso>1</curso>
<modulo>
<modulonom>daw1</modulonom>
<nota>6</nota>
<comentario>muy bien</comentario>
</modulo>
<modulo>
<modulonom>daw2</modulonom>
<nota>10</nota>
<comentario>Grande</comentario>
</modulo>
</alumno>
<alumno id="003">
<nombre>Denisa</nombre>
<apellido>Hermann</apellido>
<email>denisa#gmail.com</email>
<foto>https://google.com</foto>
<expediente>NX0003R</expediente>
<curso>1</curso>
<modulo>
<modulonom>daw3</modulonom>
<nota>9</nota>
<comentario>molt be</comentario>
</modulo>
<modulo>
<modulonom>daw2</modulonom>
<nota>5</nota>
<comentario>lo puedes mejorar</comentario>
</modulo>
</alumno>
<alumno id="004">
<nombre>Deniz</nombre>
<apellido>Turkmenista</apellido>
<email>deniz#gmail.com</email>
<foto>https://google.com</foto>
<expediente>NX0004R</expediente>
<curso>3</curso>
<modulo>
<modulonom>daw6</modulonom>
<nota>9</nota>
<comentario>Crack</comentario>
</modulo>
<modulo>
<modulonom>daw2</modulonom>
<nota>7</nota>
<comentario>Falta un</comentario>
</modulo>
</alumno>
</students>
XSD below
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="id" type="xs:string"/>
<xs:element name="nombre">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="apellido">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="email">
<xs:simpleType >
<xs:restriction base="xs:string">
<xs:pattern value="[^#]+#[^\.]+\..+"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="foto">
<xs:simpleType>
<xs:restriction base="xs:anyURI">
<xs:pattern value="https://.+" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="expediente">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z][A-Z][0-9][0-9][0-9][0-9][A-Z]"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="curso">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:pattern value="([0-9])*"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="modulonom">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="nota" >
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="comentario">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="students" >
<xs:complexType>
<xs:sequence>
<xs:element ref="alumno" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="alumno">
<xs:complexType>
<xs:sequence>
<xs:element ref="nombre"/>
<xs:element ref="apellido"/>
<xs:element ref="email"/>
<xs:element ref="foto"/>
<xs:element ref="expediente"/>
<xs:element ref="curso"/>
<xs:element ref="modulo" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute ref="id" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="modulo">
<xs:complexType>
<xs:sequence>
<xs:element ref= "modulonom" />
<xs:element ref= "nota" />
<xs:element ref= "comentario" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I did open and close everything from what I can see so I don't understand why it's throwing this error.
The error,
Error at line 2 : no declaration found for element 'xs:schema'
suggests that you are mistakenly attempting to validate the XSD itself rather than validate the XML instance document.
If you truly wish to validate your XSD, which is, afterall, also an XML document, you can use the XML Schema for Schemas. But, again, you'll have to take care to specify to your validator which document is intended to be the XML to be validated and which document is intended to be the XSD.

tag validation in XSD File

Someone knows, how to implement the following validate in the XSD file:
When the tag TIPO has the value SER, it is mandatory to register the tag DETALLES_SERVICIOS otherwise if the value is EQU, it is optional
I am using the XSD version 1.0 and I can not implement a way to do this validation.
Thanks in advance for the help.
XML
<REQUERIMIENTO>
<DETALLES_SOLICITUDES>
<ID_PLAN>BP-7138</ID_PLAN>
<ID_SUBPRODUCTO>AUT</ID_SUBPRODUCTO>
<CANTIDAD>1</CANTIDAD>
<TIPO>SER</TIPO>
<DETALLES_SERVICIOS>
<NOMBRE_USUARIO>JANIO</NOMBRE_USUARIO>
<NUMERO_SERIE>12345</NUMERO_SERIE>
<IN_BODEGA>130</IN_BODEGA>
</DETALLES_SERVICIOS>
</DETALLES_SOLICITUDES>
<DETALLES_SOLICITUDES>
<ID_PLAN>0</ID_PLAN>
<ID_SUBPRODUCTO>SAMSUNG A510 G</ID_SUBPRODUCTO>
<CANTIDAD>1</CANTIDAD>
<TIPO>EQU</TIPO>
</DETALLES_SOLICITUDES>
</REQUERIMIENTO>
XSD
<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Technologies Online Tools 1.0 (https://www.liquid-technologies.com) -->
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="REQUERIMIENTO">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="DETALLES_SOLICITUDES">
<xs:complexType>
<xs:sequence>
<xs:element name="ID_PLAN" type="xs:string" />
<xs:element name="ID_SUBPRODUCTO" type="xs:string" />
<xs:element name="CANTIDAD" type="xs:string" />
<xs:element name="TIPO">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="SER"/>
<xs:enumeration value="EQU"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" name="DETALLES_SERVICIOS">
<xs:complexType>
<xs:sequence>
<xs:element name="NOMBRE_USUARIO" type="xs:string" />
<xs:element name="NUMERO_SERIE" type="xs:unsignedShort" />
<xs:element name="IN_BODEGA" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
It is not possible to implement this in XSD-1.0, but if you find a way to use XSD-1.1, you can use the following xs:assert expression after your second xs:sequence element:
<xs:assert test="((TIPO = 'SER') and DETALLES_SERVICIOS) or (TIPO='EQU')" />
EDIT: thx to #MichaelKay to make sure that it isn't possible at all.

XML validation using XSD failing [duplicate]

This is my sample XML code:
<Address>
<StreetAddress></StreetAddress>
<OtherDestination />
<City>TORONTO</City>
</Address>
That is currently using this XSD:
<xs:element name="Address" nillable="true">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element ref="StreetAddress" minOccurs="0"/>
<xs:element ref="OtherDestination" minOccurs="0"/>
<xs:element ref="City" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
I want to add an attribute id to Address element like this..
<Address id="first">
<StreetAddress></StreetAddress>
<OtherDestination />
<City>TORONTO</City>
</Address>
How should I change the existing XSD to fulfill my requirement?
An attribute declaration can be added within xs:complexType after the xs:sequence:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="Address">
<xs:complexType>
<xs:sequence>
<xs:element name="StreetAddress" minOccurs="0" type="xs:string"/>
<xs:element name="OtherDestination" minOccurs="0" type="xs:string"/>
<xs:element name="City" minOccurs="0" type="xs:string"/>
</xs:sequence>
<!------------------------------------------>
<!-- This is where to declare attributes: -->
<xs:attribute name="id" type="xs:string"/>
<!------------------------------------------>
</xs:complexType>
</xs:element>
</xs:schema>
The above XSD will validate your XML successfully.

xsd substitution or xlt transformation

How Do I Change this XSD using substitution to get the following outcome?
I have a XML that is being returned from my asp.net API from a Saas providor. The service comes from asp.net mvc however, I can only use asp classic, and i'm pretty limited in what i can do. I can send TSQL queries to the SQL server 2005... Other than that there's not much that can be done. So my only option for what i need (well my best current option) is this. The data returns from my asp classic page service.asp. service.asp returns the structured xml based off an XSD file that is in the same folder as my script to get the data. I'll show you what it currently returns, what the current xsd is, and what it should return, and the modifications I tried making to the XSD. Hopefully that's the info someone will need to help me as this isn't exactly my strong suite. Thanks!
Current XML Response
Currently the data returns like this:
<xmldata>
<group>
<groupid>1</groupid>
<parentid>2</parentid>
<item>133</item>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
</group>
<group>
<groupid>2</groupid>
<parentid>2</parentid>
<item>134</item>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
</group>
<group>
<groupid>2</groupid>
<parentid>2</parentid>
<item>313</item>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
</group>
<group>
<groupid>3</groupid>
<parentid>2</parentid>
<item>46</item>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
</group>
</xmldata>
Current XSD File
My current XSD File is structured as follows:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="xmldata" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
<xs:element name="xmldata" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="groups">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="groupid" name="groupid" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="ParentID" msprop:SqlDbType="Int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groupproductlink">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="groupproductlink" name="ID" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="groupID" msprop:SqlDbType="Int" minOccurs="0" />
<xs:element name="ProductCode" msprop:SqlDbType="Int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Products">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="Products" name="AutoDropShip" msprop:maxLength="1" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" msprop:SQLFrom="FROM vm.Products p INNER JOIN vm.Products_Descriptions pd ON p.ProductCode = pd.ProductCode INNER JOIN vm.PE pe ON p.ProductCode = pe.ProductCode INNER JOIN vm.Products_Memos pm ON p.ProductCode = pm.ProductCode" minOccurs="0" />
<xs:element name="productid" msprop:maxLength="30" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" minOccurs="1" />
<xs:element name="ProductCode" msprop:SQLTableAlias="p" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="ProductName" msprop:maxLength="255" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
What the XML Should Be
The XML Needs to be returned in the following way (please note the attribute becoming the element)
<groups>
**<1> //<---Element=groupID**
<item>133</item>
<parentid>2</parentid>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
**</1> //<---Element=groupID
<2> //<---Element=groupID**
<item>134</item>
<parentid>2</parentid>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
**</2> //<---Element=groupID
<2> //<---Element=groupID**
<item>313</item>
<parentid>2</parentid>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>e="1">
**</2> //<---Element=groupID
<3> //<---Element=groupID**
<item>46</item>
<parentid>2</parentid>
<ProductCode>blahblah</ProductCode>
<ProductName>blahblah</ProductName>
**</3> //<---Element=groupID**
</groups>
The XSD I attempted to use and didn't get any response
I tried transforming the XSD that I listed above to the following:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="groups" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop">
**<xs:element name="groups" *msdata:IsDataSet="true"* msdata:UseCurrentLocale="true">**
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="groupid" *msdata:IsDataSet="true"* msdata:UseCurrentLocale="true" msprop:TableNameXsd="groupid" msprop:SqlDbType="Int" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="groupid" name="groupid" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="ParentID" msprop:SqlDbType="Int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="groupproductlink">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="groupproductlink" name="ID" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="groupID" msprop:SqlDbType="Int" minOccurs="0" />
<xs:element name="ProductCode" msprop:SqlDbType="Int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Products">
<xs:complexType>
<xs:sequence>
<xs:element msprop:TableNameXsd="Products" name="AutoDropShip" msprop:maxLength="1" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" msprop:SQLFrom="FROM vm.Products p INNER JOIN vm.Products_Descriptions pd ON p.ProductCode = pd.ProductCode INNER JOIN vm.PE pe ON p.ProductCode = pe.ProductCode INNER JOIN vm.Products_Memos pm ON p.ProductCode = pm.ProductCode" minOccurs="0" />
<xs:element name="productid" msprop:maxLength="30" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" minOccurs="1" />
<xs:element name="ProductCode" msprop:SQLTableAlias="p" msprop:SqlDbType="Int" msprop:IsIdentity="true" minOccurs="0" />
<xs:element name="ProductName" msprop:maxLength="255" msprop:SQLTableAlias="p" msprop:SqlDbType="VarChar" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
However,
It doesn't work currently. I think maybe I need to use a substitution group, however unfortunately it's been years since I did this and I can't remember what exactly I need to do. I truly hope someone here has some better ideas!