I am using the xsd2code VS plug-in to create some data classes from a couple of xsd files and I'm having an issue where the namespace prefix for elements in the XSD do not appear in the generated XML files.
XSD:
<xsd:complexType name="ProductMasterItemType">
<xsd:sequence>
<xsd:element ref="cmn:PrimaryItemCode"/>
<xsd:element ref="cmn:NewPrimaryItemCode" minOccurs="0"/>
<xsd:element ref="cmn:ProductGroupCode"/>
<xsd:element ref="cmn:ProductStatus"/>
<xsd:element ref="cmn:EffectiveDate" minOccurs="0"/>
<xsd:element ref="cmn:RecordStatus"/>
<xsd:element name="AlternateItemCodes" type="cmn:AlternateItemCodeListType" minOccurs="0"/>
<xsd:element name="TargetMarketList" type="mdx:TargetMarketListType" minOccurs="0"/>
<xsd:element name="ItemInfoList" type="mdx:ItemInfoListType"/>
<xsd:element name="PackagingInfoList" type="mdx:PackagingInfoListType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
generated XML:
-<ProductMasterItem>
-<PrimaryItemCode xmlns="urn:tracelink:mapper:sl:mdx:commontypes">
<type>INTERNAL_MATERIAL_CODE</type>
TestBOM5
</PrimaryItemCode>
<ProductGroupCode xmlns="urn:tracelink:mapper:sl:mdx:commontypes">100</ProductGroupCode>
<ProductStatus xmlns="urn:tracelink:mapper:sl:mdx:commontypes">Released</ProductStatus>
<RecordStatus xmlns="urn:tracelink:mapper:sl:mdx:commontypes">Active</RecordStatus>
-<TargetMarketList>
-<TargetMarket>
<CountryMarket xmlns="urn:tracelink:mapper:sl:mdx:commontypes">US</CountryMarket>
</TargetMarket>
<DeleteTargetMarket/>
</TargetMarketList>
-<ItemInfoList>
-<ItemInfo>
<LanguageCode xmlns="urn:tracelink:mapper:sl:mdx:commontypes">EN</LanguageCode>
<ProductDescription xmlns="urn:tracelink:mapper:sl:mdx:commontypes">Test BOM 5</ProductDescription>
<DrugName xmlns="urn:tracelink:mapper:sl:mdx:commontypes">Nameofadrug</DrugName>
<Manufacturer xmlns="urn:tracelink:mapper:sl:mdx:commontypes">- No Manufacturer -</Manufacturer>
<Strength xmlns="urn:tracelink:mapper:sl:mdx:commontypes">verystrong</Strength>
<DosageForm xmlns="urn:tracelink:mapper:sl:mdx:commontypes">15ml</DosageForm>
<PackageSize xmlns="urn:tracelink:mapper:sl:mdx:commontypes">40ml</PackageSize>
</ItemInfo>
<DeleteItemInfo/>
</ItemInfoList>
The generated XML doesn't have the 'cmn' namespace prefix for the elements. Did I generate the classes incorrectly when I ran the plug-in? Is this something I need to change in the plug-ins source code?
I don't have a lot of experience working with XML so I apologize if this isn't enough information. If I'm missing something you'd need to know to help answer let me know! Thanks in advance :)
No comments:
Post a Comment