View Full Version : Down and Dirty xml->xsd

02-18-2007, 10:31 AM
I use XML fabricated (or in-memory) persisted recordsets more often than arrays or structures in many endeavors. Fabricated Recordsets are simply ADODB.Recordsets without an underlying Database table, yet when persisted and opened they behave like a DB Table in that records can be added, modified, deleted sorted etc...

Persisted xml differs from what you might be accustomed to in that it contains a 'schema' unique to making it accessible as a recordset. However, this schema has no relation to a validation schema (.xsd file extension) and cannot be easily converted to one. I did find an interesting aspect of Excel 2003 (don't know if it works in 2000-2002:dunno ) that permits the conversion.

The attached zip contains a persisted xml file with a single row. It was created in-memory and contains several field types. There is also an xls file with a single sub to output an xsd schema based on the xml 'fields'.

I can achieve the same or better results with the XMLDOM, but that requires a lot more coding; If I needed a quick xsd validation file for a structure delivered or accepted via a Web Service, this little Excel trick will suffice.

Bored or confused... don't download... vaguely interested, takes about 2 seconds to run. Stan

02-18-2007, 11:55 AM
P.S. - these were the only references I used

02-18-2007, 12:07 PM
I'm getting an error trying to run it in Office 2000 with the same references. Just looking out of curiosity, so no big issue.

02-18-2007, 01:34 PM
I'm getting an error trying to run it in Office 2000 with the same references.

It's probably a 2002-2003 enhancement. Stan