Embedding an XSD into an XML file

Sunday 8 August 2010 @ 9:43 pm

This is a follow-up to an earlier post about reading XML File with Crystal Reports.  One of the main things I mentioned at the time was the lack of documentation.  I have since found the following articles that have helped a great deal:

Structuring XML Data for the Crystal Reports XI Native XML Driver

Using ODBC XML Data with Crystal Reports (version 10 and prior)

These articles have moved but you can search the SAP Support site and it should bring them up:

Another thing I mentioned was that out of three XML connection methods offered by CR, only one could read both the XML and XSD files.  If you don’t have both the XML and the XSD then you get either:

1) the data types but no data, or

2) the data with all fields being character data.

But what I missed is that instead of a separate XSD file you can embed the entire XSD schema inside the XML file.  One of my readers, Guy Francoeur, was nice enough to point this out and even sent me an example.  I have since found that this is called an “Inline” schema.  So I used Guy’s example to create my own example which you can view or download if needed.  Crystal can connect to this XML file using either the “ADO.NET (XML)” connection method or the “Database Files” connection method.  And either way you get both the records and the defined data type of each field.

Leave a Reply

Recrystallize Pro

Crystal Reports Server