STAG-AUTOSCHEMA(1)
π STAG-AUTOSCHEMA π
okay bestie, pull up a chair, we're doing a Perl thing and honestly? it's giving so useful. this one lives in the User Contributed Perl Documentation section of the manual, and yes it's a whole lil command-line baddie π
β¨ NAME β¨
stag-autoschema β she writes the implicit stag-schema for a stag file π
no literally, that's the whole job. she looks at your file, she figures out the schema hiding inside it, she hands it to you. iconic behaviour.
πΈ SYNOPSIS πΈ
stag-autoschema -w sxpr sample-data.xml
stag-autoschema -dtd sample-data.xml
that's it. two little lines. two whole vibes. π¦
π«Ά DESCRIPTION π«Ά
so the tea is: she takes a stag compatible file β that's xml, sxpr, or itext β or honestly a file in any format if you also hand her a parser, and she writes out the implicit underlying stag-schema for it. like she reverse-engineers the structure from the actual data. main character detective energy πβ¨
and ngl, stag-schema should look relatively self-explanatory once you see it.
here's an example stag-schema, shown in sxpr syntax:
(db
(person*
(name "s"
(address+
(address_type "s")
(street "s")
(street2? "s")
(city "s")
(zip? "s")))))
so what's she saying here? the database db contains zero or more persons, each person has a mandatory name and at least one address. periodt. π
the cardinality mnemonics are as follows:
+β 1 or more?β 0 or one*β 0 or more
and the default cardinality is 1 π
β ARGUMENTS β
-p|parser FORMATβ FORMAT is one ofxml,sxproritext, or the name of a perl module. and guess what,xmlis assumed as default. she's not gonna make you type it every time, she's nice like that π₯°-dtdβ exports schema as DTD. simple. clean. slay.-w|writer FORMATβ FORMAT is one ofxml,sxproritext, or the name of a perl module, ORDTD. the default issxpr.
β οΈ okay important bestie, listen: note that stag schemas exported as xml will be invalid xml, due to the use of symbols*,+,?in the node names. that's not a bug she's hiding from you, that's just what happens. the girlies know. π
π¦ LIMITATIONS π¦
she is not event based β memory usage becomes exhorbitant on large files. so like, prepare a small sample beforehand. do not feed her your entire 4GB dataset and act surprised, i'm begging π
π POD ERRORS π
hey! the above document had some coding errors, which are explained below:
- around line 137:
- expected text after
=item, not a bullet
- expected text after
(not me telling on the manpage itself but okay go off, documentation π )
perl v5.42.0 Β· 2025-07-25
and that's the whole page bestie!! built on perl v5.42.0, dated 2025-07-25, and living its best life in the User Contributed Perl Documentation section π«Άβ¨ go write some schemas, you've got this, mwah π
π¦ where this page comes from
- fedora 43: perl-Data-Stag 0.14-28.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms