Getting a schema for mssecure.xml with “infer”

[Listening to: Mozart – Fur Elise (03:34)]

While looking for a way to handle patch management mini-tasks, I ran across the following response by a Microsoft employee to a request for the schema for mssecure.xml (in context, the softie did not sound happy about having to give this kind of answer):
Microsoft doesn’t publish the schema for the MSSECURE.XML file. We reserve the right to modify, change and update the schema as necessary to enhance products that rely on and use the MSSECURE.XML file.

That’s not precisely true. Microsoft does publish a schema, an implicit one. What people tend to forget is that any well-formed XML file conforms to a schema. It may not be a formal one or even an appropriate one, but a schema can be inferred from that XML file instance.
Of course, no one wants to spend hours trying to determine a schema from a 1.7 MiB file. If you get Microsoft’s own xsdinfer tool, though, you can automatically parse the schema in seconds.

I proceeded to do that with the latest (2003-10-03) mssecure.xml and I have made the inferred mssecure.xsd file available as a zipped download.
Note that this is incredibly easy to do. I simply ran
  infer mssecure.xml -o mssecure
and had mssecure_1.xsd ready in seconds. The schema is very clean considering the size of mssecure.xml; it reduces to 11.8 KiB and compresses to 1.7 in the download.

2 thoughts on “Getting a schema for mssecure.xml with “infer”

  1. Intriguing! I looked it up shortly after you posted and played with it a bit.

    Unfortunately, it turns out that there is a circular reference in automatically generated schemas for mssecure.xml. I suspect it culd be normalized out of existence by someone who knows what they are doing, but for me validation has come to a screeching halt. 😉

Leave a Reply

Your email address will not be published. Required fields are marked *