XDR to XSD conversion

Hello,

   I am working on one C# program, where I want to convert XDR file to XSD file.

   I have tried the option of xsd.exe. It converts the xdr to xsd but not in correct structure. i.e. it does not create the XSD with correct root node.

   I tried with creating the XSD file using the below option and it creates correctly.

   In Biztalk, we have three methods to generate schema through "Add generated Items>Generate Schemas>" -- DTD Schema , Well-Formed XML   & XDR Schema.  

      As I said I want to call this utility in C# code, I was checking for DLL for XDR Schema, but could not find. whereas the DLL for other two is present (Microsoft.BizTalk.DTDToXSDGenerator   ,   Microsoft.BizTalk.WFXToXSDGenerator).

   Does anyone knows where can I find the dll for XDR to XSD conve

February 10th, 2014 9:00am

Hi Atul,

I think BizTalk's "Generate Schemas Wizard" uses XDRtoXSD.xsl for XDR to XSD convertion.

This strylesheet exist in "<<your installation directory>>\Microsoft BizTalk Server <<version>>" (C:\Program Files (x86)\Microsoft BizTalk Server 2010).

If you want to extend/reuse this Wizard's functionality, you can apply this stylesheet on the XDR to generate XSD. Its worth a try.

Based on the article from MSDN: Extending the Schema Generator Wizard, only Microsoft.BizTalk.DTDToXSDGenerator.dll and Microsoft.BizTalk.WFXToXSDGenerator.dll  are available as dll for extending the schema generator wizard. I think for XDR to XSD you have to use XDRtoXSD.xsl file.

Free Windows Admin Tool Kit Click here and download it now
February 10th, 2014 9:32am

Try the wizard first to compare the results of xsd.exe.

High fidelity conversion from XDR to XSD is not always possible.  What do you mean by "not create the XSD with correct root node."

If the Wizard does the same thing, maybe you can stick with the xsd.exe version.

February 10th, 2014 9:42am

Hi Ashwinprabhu,

    I tried using XDRtoXSD.xsl for XDR to XSD converion, but it creates invalid schema. First thing it doesn't show the proper structure and second thing it says 'Invalid schema, does not find root node' when I try to use it in map. 

Also, it has created all the nodes with 'Type' as extra word added to it. For example, VIATERMS_X12 became VIATERMS_X12Type. I tried to recreate it by removing the 'Type' word from xslt. But still it gives same error as above.

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2014 2:15am

Hi boatseller,

    By using xsd.exe it created many root nodes. Whereas in my XDR, the root node name is mentioned as 'INVOICES'.

<Schema name="INVOICES" b:BizTalkServerEditorTool_Version="1.5" b:root_reference="INVOICES"b:standard="XML" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:b="urn:schemas-microsoft-com:BizTalkServer" xmlns:d="urn:schemas-microsoft-com:datatypes">

 'INVOICES' is the root node which got created inside the schema node. please see below image,

February 11th, 2014 3:01am

IMHO, it is OK. Can you use the converted XDR in Visual Studio and generate an Instance File or validate an existing instance? If it does both, then you should be good to go.

If you notice the b:root_reference is set to INVOICES, so that is the root node.

Regards.

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2014 4:02am

Hi Atul,

Is your requirement to build C# converter application for XDR to XSD?

XDRtoXSD.xsl is the one which has been used by BizTalk's "Generate Schemas Wizard". This xsl file has been with BizTalk from its early days-2002. We haven't tried it programmatically, either Microsoft has any guidance on using this file.

First try convert the XDR to XSD using the BizTalk wizard and validate the output. Then you can use the XSD.exe with correct parameter to generate the required XSD.

February 11th, 2014 4:38am

Please keep in mind that XDR & XSD are not 100% compatible and there were some very fundamental changes when XSD was finally introduced.

So, it is not at all uncommon to have to modify the XSD to actually conform to the Xml you're sending or receiving.

On xsd.exe vs the Wizard, you'll have to pick which ever gets you closest then do the rest by hand.  Sorry, that's just how it is.  I've had to do that many times.

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2014 3:56pm

Please keep in mind that XDR & XSD are not 100% compatible and there were some very fundamental changes when XSD was finally introduced.

So, it is not at all uncommon to have to modify the XSD to actually conform to the Xml you're sending or receiving.

On xsd.exe vs the Wizard, you'll have to pick which ever gets you closest then do the rest by hand.  Sorry, that's just how it is.  I've had to do that many times.

  • Proposed as answer by Girish R. Patil Thursday, February 13, 2014 2:39 AM
February 11th, 2014 3:56pm

Please keep in mind that XDR & XSD are not 100% compatible and there were some very fundamental changes when XSD was finally introduced.

So, it is not at all uncommon to have to modify the XSD to actually conform to the Xml you're sending or receiving.

On xsd.exe vs the Wizard, you'll have to pick which ever gets you closest then do the rest by hand.  Sorry, that's just how it is.  I've had to do that many times.

Free Windows Admin Tool Kit Click here and download it now
February 11th, 2014 3:56pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics