W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2004

Re: Need Help

From: Lee Brown <lbrown@cyberguard.com>
Date: Thu, 17 Jun 2004 21:26:57 -0400
Message-ID: <001901c454d3$58c98150$0200a8c0@GLOUCESTER>
To: <xmlschema-dev@w3.org>
I'm not a schema expert by a long shot, but I'll go out on a limb and say the short answer to your question is that you cannot, that you cannot write a schema when the XML has indeterminate element names.  Likely someone will come along in the next few minutes and tell us the simple and obvious way to do it, it's been that sort of day.

However, all is not lost.  Depending on your situation, either of these two approaches may be satisfactory.  If the purpose of your reverse engineering task is merely to document the structure of the XML files, and the schema will not ever actually be used to validate your XML documents, then pick some representative element names, as in your example, and move on.

If it is important to have a schema to validate with, then create each schema dynamically.  In either event, your schema should probably define a named complex type to describe the attributes and child elements.  Use an XSL translation on your subject XML file to produce the schema lines that fill in the sequence or choice of command elements that are children of <Commands>, surrounded by your prototype schema (if it were me I'd probably use an included file).  Then make a second pass over the XML to validate it against the schema produced in your first pass.

Hope that helps,
A Different Lee
Received on Thursday, 17 June 2004 21:27:19 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:05 UTC