View Full Version : xsd parsing -> csv -> Excel (maybe)?

01-04-2007, 01:11 PM
.xsd files are really xml files meant to replace the DTD documentation standard. In effect they are validation schemas to insure that xml data is passed correctly to and from applications. Creating an xsd is not that difficult and there are plenty of free tutorials. However, consider being given one and asked to parse it in such a way that you get an understanding of the 'rules' contained within the various nodes.

Anyway, I found the free Logparser COM dll ideal in that it accepts xsd as input and can output as .csv, creating header rows. Problem is the csv is redundant, and it would be nice if it could be loaded into excel and a Pivot created to represent a semi-treeview.

The attached zip has an xsd that is part of a large validation structure for SIF (Schools Interoperability Framework - the next 'holy grail' of data consistency). Then there is a .csv created from it via LogParser [could be done as a single command line if you don't want to use the dll).

Question: might it be possible to format the csv as a meaningful pivot?:doh: Stan

01-05-2007, 07:16 AM
as a P.S. to anyone who suggests "Why Not Just use 'Msxml2.XMLSchemaCache.5.0' ? "

I tried that first, just get some obnoxious Microsoft error codes, since the elements are resolved via ref=, not locally [was my best guess].:banghead: Stan

01-05-2007, 12:00 PM
Hi Stan,:hi:

Do a search for "XML Notepad 2007" the download is a handy little tool that takes a .xlm or .xsd files and displays it in a somewhat human readable format. Using this you will see the errors (2).:clap:

It looks to me like more of a user defined type with validation entries for elements and data types defined. May be useful for defining a database/table also.:dunno

I have no clue what a pivot table is other than the help files.

01-06-2007, 06:25 AM
Thanx Tommy, I overlooked that tool:clap:

Unfortunately, I cannot resolve the error [really a warning, according to WC3] since

<element name='Confidence' type='string'/>

is really valid XML. The real problem is that when using code such as

cXSD = "StudentLocator.xsd"
oCache = CreateObject("Msxml2.XMLSchemaCache.5.0") 'change to 4.0/3.0 depending
cTarget = "http://www.sifinfo.org/infrastructure/1.x"
oCache.add cTarget, cXSD

it errors out [see JPG] in a totally different area [hmm... 2 Microsoft products disagreeing with each other:devil2: ]. The xsd file is part of the SIF Specification http://www.sifinfo.org/ so I have some confidence about its validity [of course with the caveat that 'school excellence' may be an oxymoron]. So at least LogParser can be scripterd to output w/out errors.

Thanks again. I'll leave this open over the weekend for addtional comments then close the thread. Stan