STAG-AUTOSCHEMA(1p)

πŸ“¦
version 0.14 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

✨ NAME ✨

okay so bestie, welcome to stag-autoschema β€” she writes the implicit stag-schema for a stag file πŸ’– no cap, that's the whole gig.


🌸 SYNOPSIS 🌸

stag-autoschema -w sxpr sample-data.xml

stag-autoschema -dtd sample-data.xml

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: you hand her a stag compatible file β€” that's xml, sxpr, or itext β€” or honestly any format at all as long as you also give her a parser, and she'll write out the implicit underlying stag-schema for you. slay.

ngl, stag-schema should look relatively self-explanatory. periodt.

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")))))

okay so let's decode this iconic little tree 🌈: the database db contains zero or more persons, each person has a mandatory name and at least one address. she ate.

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 jsyk, xml is assumed as default πŸ‘‘
  • -dtd β€” exports schema as DTD πŸŽ€
  • -w|writer FORMAT β€” FORMAT is one of xml, sxpr or itext, or the name of a perl module, OR DTD. 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 β€” yeah bestie, that's real, not a drill 😭

πŸ’€ LIMITATIONS πŸ’€

not event based β€” memory usage becomes exhorbitant on large files; prepare a small sample beforehand πŸ™ˆ like fr fr, bring a snack-sized sample, your RAM will thank you.


perl v5.34.0 Β· 2022-06-12 β€” that's the whole lore, written on that date, running on that perl, and that's a wrap bestie 🫢✨ bye ily πŸ’–

πŸ“¦ where this page comes from