stag-autoschema.pl - writes the implicit stag-schema for a stag file
stag-autoschema.pl -w sxpr sample-data.xml
Takes a stag compatible file (xml, sxpr, itext), or a file in any format plus a parser, and writes out the implicit underlying stag-schema
stag-schema should look relatively self-explanatory.
Here is an example stag-schema, shown in sxpr syntax:
(db (person* (name "s" (address+ (address_type "s") (street "s") (street2? "s") (city "s") (zip? "s")))))
The database db contains zero or more persons, each person has a mandatory name and at least one address.
The cardinality mnemonics are as follows:
The default cardinality is 1
xml assumed as default
The default is sxpr
note that stag schemas exported as xml will be invalid xml, due to the use of symbols *, +, ? in the node names
add DTD option
not event based - memory usage becomes exhorbitant on large files; prepare a small sample beforehand