Ajustes
This commit is contained in:
parent
dfbaa98af6
commit
f16ecab458
133
README.md
133
README.md
|
@ -1,6 +1,4 @@
|
|||
---
|
||||
warn: This is just a prototype.
|
||||
---
|
||||
\[TOC\]
|
||||
|
||||
# YASD, Yet Another Schema Definition
|
||||
|
||||
|
@ -8,6 +6,36 @@ YASD is a YAML format for human writable XSDs (XML Schema Definition), humans
|
|||
declare what is indispensable, leaving the machines to do the rest of the
|
||||
unreadable `<syntaxis who_can_read_this="?" />`.
|
||||
|
||||
## Workflow
|
||||
|
||||
The following chart is the YASD CLI flow:
|
||||
|
||||
``` mermaid
|
||||
flowchart LR
|
||||
direction LR
|
||||
yasd --- convert
|
||||
yasd --- check
|
||||
yasd --- sample
|
||||
yasd --- document
|
||||
yasd --- man
|
||||
convert --- |from| YASD1([YASD])
|
||||
YASD1 --> |to| XSD([XSD])
|
||||
check --- |validates| YASD2([YASD])
|
||||
sample --- |from| YASD3([YASD])
|
||||
YASD3 --> |to| XML([XML])
|
||||
document --- |from| YASD4([YASD])
|
||||
YASD4 --> |to| MD([Markdown])
|
||||
man --- |prints| README
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
To better understad what YASD does, see the inputs and outputs:
|
||||
|
||||
- Input: human workable schema in [YASD].
|
||||
- Output: computer processable schema in [XSD].
|
||||
- Output: human readable documentation in [Markdown].
|
||||
|
||||
## Structure
|
||||
|
||||
General structure:
|
||||
|
@ -77,27 +105,27 @@ Group (GRPS) structure:
|
|||
|
||||
## Reference
|
||||
|
||||
### `elementFormDefault`[^1]
|
||||
### `elementFormDefault`[^1] {#elementformdefault1}
|
||||
|
||||
Indicates that any elements used by the XML instance document which were
|
||||
declared in this schema must be namespace qualified.
|
||||
|
||||
Optional; if not present by default is `unqualified`.
|
||||
|
||||
### `taget_namespace`[^1]
|
||||
### `taget_namespace`[^2] {#taget_namespace1}
|
||||
|
||||
Indicates that the elements defined by this schema come from the specified URL
|
||||
namespace.
|
||||
|
||||
Optional.
|
||||
|
||||
### `xmlns`[^1]
|
||||
### `xmlns`[^3] {#xmlns1}
|
||||
|
||||
Indicates that the default namespace is the specified URL.
|
||||
|
||||
Mandatory.
|
||||
|
||||
### `schemaLocation`[^1]
|
||||
### `schemaLocation`[^4] {#schemalocation1}
|
||||
|
||||
Indicates the location of the XML schema to use for that namespace.
|
||||
|
||||
|
@ -122,7 +150,8 @@ Naming rules:
|
|||
- Element names are case-sensitive
|
||||
- Element names must start with a letter or underscore
|
||||
- Element names cannot start with the letters xml (or XML, or Xml, etc)
|
||||
- Element names can contain letters, digits, hyphens, underscores, and periods
|
||||
- Element names can contain letters, digits, hyphens, underscores, and
|
||||
periods
|
||||
- Element names cannot contain spaces
|
||||
|
||||
### `description`
|
||||
|
@ -147,19 +176,19 @@ Allowed types:
|
|||
|
||||
Chart:
|
||||
|
||||
|type | children elements | text node | attributes |
|
||||
|------------|:-----------------:|:----------:|:----------:|
|
||||
|simple | ✗ | ✓ | ✗ |
|
||||
|empty | ✗ | ✗ | ✓ |
|
||||
|no_text | ✓ | ✗ | ✓ |
|
||||
|no_elements | ✗ | ✓ | ✓ |
|
||||
|mixed | ✓ | ✓ | ✓ |
|
||||
| type | children elements | text node | attributes |
|
||||
|------------|:-----------------:|:---------:|:----------:|
|
||||
|simple | ✗ | ✓ | ✗ |
|
||||
|empty | ✗ | ✗ | ✓ |
|
||||
|no_text | ✓ | ✗ | ✓ |
|
||||
|no_elements | ✗ | ✓ | ✓ |
|
||||
|mixed | ✓ | ✓ | ✓ |
|
||||
|
||||
> **Note**: attributes are never mandatory; they could be zero or more.
|
||||
|
||||
### `datatype`
|
||||
|
||||
Indicates element or attribute data types.[^2]
|
||||
Indicates element or attribute data types.[^5]
|
||||
|
||||
Only mandatory for 'simple' and 'no_elements' elements, and attributes.
|
||||
|
||||
|
@ -169,8 +198,8 @@ Allowed String Data Types:
|
|||
- `ENTITY`.
|
||||
- `ID`. A string that represents the ID attribute in XML (only used with
|
||||
schema attributes).
|
||||
- `IDREF`. A string that represents the IDREF attribute in XML (only used with
|
||||
schema attributes).
|
||||
- `IDREF`. A string that represents the IDREF attribute in XML (only used
|
||||
with schema attributes).
|
||||
- `IDREFS`.
|
||||
- `language`. A string that contains a valid language id.
|
||||
- `Name`. A string that contains a valid XML name.
|
||||
|
@ -247,7 +276,7 @@ Optional.
|
|||
|
||||
Only `required` is valid as value.
|
||||
|
||||
### `restriction`[^3]
|
||||
### `restriction`[^6] {#restriction3}
|
||||
|
||||
Indicates accepted constrained values for element or attribute.
|
||||
|
||||
|
@ -275,8 +304,8 @@ Allowed constrains:
|
|||
- `minLength`. Specifies the minimum number of characters or list items
|
||||
allowed; must be equal to or greater than zero.
|
||||
- `pattern`. Defines the exact sequence of characters that are acceptable.
|
||||
- `totalDigits`. Specifies the exact number of digits allowed; must be greater
|
||||
than zero.
|
||||
- `totalDigits`. Specifies the exact number of digits allowed; must be
|
||||
greater than zero.
|
||||
- `whiteSpace`. Specifies how white space (line feeds, tabs, spaces, and
|
||||
carriage returns) is handled; accepted values are
|
||||
`preserve|replace|collapse`.
|
||||
|
@ -340,8 +369,8 @@ Optional; if not present by default is `false`.
|
|||
|
||||
Allowed values:
|
||||
|
||||
- `true`.
|
||||
- `false`.
|
||||
- `true`.
|
||||
- `false`.
|
||||
|
||||
### `elements`
|
||||
|
||||
|
@ -363,37 +392,51 @@ Mandatory.
|
|||
|
||||
## Command-Line Interface
|
||||
|
||||
```
|
||||
usage: yasd [-h] [-q] [-l] [-n NUM] {convert,check,sample,document,man} [file]
|
||||
usage: yasd [-h] [-q] [-l] [-n NUM] {convert,check,sample,document,man} [file]
|
||||
|
||||
YASD, Yet Another Schema Definition. YASD is a YAML format for human writable
|
||||
XSDs (XML Schema Definition), humans declare what is indispensable, leaving
|
||||
the machines to do the rest of the unreadable <syntaxis who_can_read_this="?"
|
||||
/>.
|
||||
YASD, Yet Another Schema Definition. YASD is a YAML format for human writable
|
||||
XSDs (XML Schema Definition), humans declare what is indispensable, leaving
|
||||
the machines to do the rest of the unreadable <syntaxis who_can_read_this="?"
|
||||
/>.
|
||||
|
||||
positional arguments:
|
||||
{convert,check,sample,document,man}
|
||||
action to perform
|
||||
file file in YAML format
|
||||
positional arguments:
|
||||
{convert,check,sample,document,man}
|
||||
action to perform
|
||||
file file in YAML format
|
||||
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-q, --quiet enable quiet mode
|
||||
-l, --log write log
|
||||
-n NUM, --num NUM number of XML samples; 1 by default
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
-q, --quiet enable quiet mode
|
||||
-l, --log write log
|
||||
-n NUM, --num NUM number of XML samples; 1 by default
|
||||
|
||||
(c) 2023 Perro Tuerto <hi@perrotuerto.blog>. Founded by Mexican Academy of
|
||||
Language <https://academia.org.mx>. Licensed under GPLv3
|
||||
<https://www.gnu.org/licenses/gpl-3.0.en.html>.
|
||||
```
|
||||
(c) 2023 Perro Tuerto <hi@perrotuerto.blog>. Founded by Mexican Academy of
|
||||
Language <https://academia.org.mx>. Licensed under GPLv3
|
||||
<https://www.gnu.org/licenses/gpl-3.0.en.html>.
|
||||
|
||||
[^1]: The following explanation is practically a copy-paste from "XSD - The
|
||||
<schema> Element", W3Schools. Cfr.
|
||||
`<schema>`{=html} Element", W3Schools. Cfr.
|
||||
<https://www.w3schools.com/xml/schema_schema.asp>.
|
||||
|
||||
[^2]: The following explanation is practically a copy-paste from "XSD Data
|
||||
[^2]: The following explanation is practically a copy-paste from "XSD - The
|
||||
`<schema>`{=html} Element", W3Schools. Cfr.
|
||||
<https://www.w3schools.com/xml/schema_schema.asp>.
|
||||
|
||||
[^3]: The following explanation is practically a copy-paste from "XSD - The
|
||||
`<schema>`{=html} Element", W3Schools. Cfr.
|
||||
<https://www.w3schools.com/xml/schema_schema.asp>.
|
||||
|
||||
[^4]: The following explanation is practically a copy-paste from "XSD - The
|
||||
`<schema>`{=html} Element", W3Schools. Cfr.
|
||||
<https://www.w3schools.com/xml/schema_schema.asp>.
|
||||
|
||||
[^5]: The following explanation is practically a copy-paste from "XSD Data
|
||||
Types", W3Schools. Cfr. <https://www.w3schools.com/xml/schema_intro.asp>.
|
||||
|
||||
[^3]: The following explanation is practically a copy-paste from "XSD
|
||||
[^6]: The following explanation is practically a copy-paste from "XSD
|
||||
Restrictions/Facets", W3Schools. Cfr.
|
||||
<https://www.w3schools.com/xml/schema_facets.asp>.
|
||||
|
||||
[YASD]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.yaml
|
||||
[XSD]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.xsd
|
||||
[Markdown]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.md
|
||||
|
|
Loading…
Reference in New Issue