0

I have an XML String that I want to load into an Excel worksheet. I've almost got it to work but I need to be able to generate the schema for passing to XmlMaps.Add:

String xml; //This is already populated with an XML String; I want to get the schema based on the xml structure
Workbook w = Globals.ThisAddIn.Application.ActiveWorkbook;
w.XmlMaps.Add(***Need schema here***, "root node");

Is it possible to generate the schema programmatically here? I am receiving this XML string from a web service.

vincentvanjoe
  • 767
  • 1
  • 12
  • 23
  • 1
    Any generated xsd from xml will be missing information, like what numeric type should this be? What are the valid ranges? What are the other possible values for this enum? Are these xml strings so wildly different that you'll need to have a new schema for each one, or could you create a static schema file to reuse? – Denise Skidmore May 27 '14 at 21:08
  • They could vary widely but we could use a static schema to begin. – vincentvanjoe May 27 '14 at 21:21
  • Then you could use a tool like http://www.freeformatter.com/xsd-generator.html to generate the xsd, although I recommend cleaning it up and adding more possibilities with something like http://download.cnet.com/XmlPad/3000-7241_4-10252051.html – Denise Skidmore May 27 '14 at 21:40
  • Or you might check with the web service publisher and see if they can just give you the xsd. That should be easily available. – Denise Skidmore May 27 '14 at 21:41

0 Answers0