STAG-AUTOSCHEMA(1)

πŸ“¦
version 0.14 Β· 3 versions
, in fedora 43

πŸ’– 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 of xml, sxpr or itext, or the name of a perl module. and guess what, xml is 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 of xml, sxpr or itext, or the name of a perl module, OR DTD. the default is sxpr.
⚠️ 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

(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