Compare commits
10 Commits
30d05f325d
...
5ef0994a93
Author | SHA1 | Date |
---|---|---|
perro tuerto | 5ef0994a93 | |
perro tuerto | d7ddb5f088 | |
perro tuerto | 5e21d1f3b3 | |
perro tuerto | adc543e608 | |
perro tuerto | fdd44d72ff | |
perro tuerto | 9db7d96a06 | |
perro tuerto | 0755e93695 | |
perro tuerto | 6e1ed70a78 | |
perro tuerto | 247f05f851 | |
perro tuerto | f889062ad9 |
|
@ -0,0 +1 @@
|
|||
.yasd.py@*
|
104
README.md
104
README.md
|
@ -1,3 +1,7 @@
|
|||
---
|
||||
WARN: It is just a prototype and currently just a subset of XSD capabilities.
|
||||
---
|
||||
|
||||
# YASD, Yet Another Schema Definition
|
||||
|
||||
YASD is a YAML format for human writable XSDs (XML Schema Definition), humans
|
||||
|
@ -22,7 +26,7 @@ flowchart LR
|
|||
sample --- |from| YASD3([YASD])
|
||||
YASD3 --> |to| XML([XML])
|
||||
document --- |from| YASD4([YASD])
|
||||
YASD4 --> |to| MD([Markdown])
|
||||
YASD4 --> |to| RST([reStructuredText])
|
||||
man --- |prints| README
|
||||
```
|
||||
|
||||
|
@ -32,11 +36,11 @@ 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].
|
||||
- Output: human readable documentation in [reStructuredText].
|
||||
|
||||
## Table of Contents
|
||||
|
||||
[TOC]
|
||||
\[TOC\]
|
||||
|
||||
## Structure
|
||||
|
||||
|
@ -47,7 +51,7 @@ To better understad what YASD does, see the inputs and outputs:
|
|||
elements:
|
||||
- ELMT
|
||||
...
|
||||
attributes:
|
||||
attributeElements:
|
||||
- ATTR
|
||||
...
|
||||
groups:
|
||||
|
@ -67,20 +71,19 @@ To better understad what YASD does, see the inputs and outputs:
|
|||
description: Element description
|
||||
type: simple|empty|no_text|no_elements|mixed
|
||||
datatype: string|integer|decimal|date|time|language|duration|token|boolean|byte|int|double|float|long|short|normalizedString|dateTime|gDay|gMonth|gMonthDay|gYear|gYearMonth|negativeInteger|nonNegativeInteger|nonPositiveInteger|positiveInteger|unsignedLong|unsignedInt|unsignedShort|unsignedByte|anyURI|base64Binary|hexBinary|Name|QName|NCName|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS|NOTATION
|
||||
default: a_value
|
||||
fixed: a_value
|
||||
restriction:
|
||||
CONSTRAIN
|
||||
...
|
||||
attribute:
|
||||
- attribute_name
|
||||
attributes:
|
||||
- ref: attribute_name
|
||||
use: optional|required|prohibited
|
||||
- group: group_name
|
||||
...
|
||||
children_order: all|choice|sequence
|
||||
children:
|
||||
- name: element_name
|
||||
maxOccurs: INTEGER
|
||||
- ref: element_name
|
||||
maxOccurs: INTEGER|unbounded
|
||||
minOccurs: INTEGER
|
||||
- group_ref: group_name
|
||||
maxOccurs: INTEGER|unbounded
|
||||
minOccurs: INTEGER
|
||||
- group: group_name
|
||||
...
|
||||
|
||||
### Attribute (ATTR) structure
|
||||
|
@ -90,9 +93,8 @@ To better understad what YASD does, see the inputs and outputs:
|
|||
datatype: string|integer|decimal|date|time|language|duration|token|boolean|byte|int|double|float|long|short|normalizedString|dateTime|gDay|gMonth|gMonthDay|gYear|gYearMonth|negativeInteger|nonNegativeInteger|nonPositiveInteger|positiveInteger|unsignedLong|unsignedInt|unsignedShort|unsignedByte|anyURI|base64Binary|hexBinary|Name|QName|NCName|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS|NOTATION
|
||||
default: a_value
|
||||
fixed: a_value
|
||||
use: required
|
||||
restriction:
|
||||
CONSTRAIN
|
||||
- CONSTRAIN
|
||||
...
|
||||
|
||||
### Group (GRPS) structure
|
||||
|
@ -101,7 +103,7 @@ To better understad what YASD does, see the inputs and outputs:
|
|||
attribute_group: true|false
|
||||
children_order: all|choice|sequence
|
||||
children:
|
||||
- name: element_name
|
||||
- ref: element_or_attribute_name
|
||||
maxOccurs: INTEGER|unbounded
|
||||
minOccurs: INTEGER
|
||||
|
||||
|
@ -141,7 +143,7 @@ Mandatory.
|
|||
|
||||
### `name`
|
||||
|
||||
Indicates element or attribute name.
|
||||
Indicates element, attribute or group name.
|
||||
|
||||
Mandatory.
|
||||
|
||||
|
@ -156,6 +158,12 @@ Naming rules:
|
|||
periods
|
||||
- Element names cannot contain spaces
|
||||
|
||||
### `ref`
|
||||
|
||||
References element or attribute by name.
|
||||
|
||||
Mandatory.
|
||||
|
||||
### `description`
|
||||
|
||||
Indicates element or attribute description in human readable form.
|
||||
|
@ -172,21 +180,23 @@ Allowed types:
|
|||
|
||||
- `simple`. Only text node allowed.
|
||||
- `empty`. Only attributes allowed.
|
||||
- `no_text`. No text nodes allowed.
|
||||
- `no_text`. No children text nodes allowed.
|
||||
- `no_elements`. No children elements allowed.
|
||||
- `mixed`. Children elements, text node and attributes allowed.
|
||||
|
||||
Chart:
|
||||
|
||||
| type | children elements | text node | attributes |
|
||||
|------------|:-----------------:|:---------:|:----------:|
|
||||
|simple | ✗ | ✓ | ✗ |
|
||||
|empty | ✗ | ✗ | ✓ |
|
||||
|no_text | ✓ | ✗ | ✓ |
|
||||
|no_elements | ✗ | ✓ | ✓ |
|
||||
|mixed | ✓ | ✓ | ✓ |
|
||||
| type | elements | text | attributes |
|
||||
|-------------|:--------:|:----:|:----------:|
|
||||
| simple | ✗ | ✓ | ✗ |
|
||||
| empty | ✗ | ✗ | ✓ |
|
||||
| no_text | ✓ | ✗ | ✓ |
|
||||
| no_elements | ✗ | ✓ | ✓ |
|
||||
| mixed | ✓ | ✓ | ✓ |
|
||||
|
||||
> **Note**: attributes are never mandatory; they could be zero or more.
|
||||
> **Note 1**: read "elements" and "text" with "direct children..." as prefix.
|
||||
|
||||
> **Note 2**: attributes are never mandatory; they could be zero or more.
|
||||
|
||||
### `datatype`
|
||||
|
||||
|
@ -264,27 +274,34 @@ Indicates default value when element or attribute is empty.
|
|||
|
||||
Optional.
|
||||
|
||||
Only allowed for simple elements or attributes.
|
||||
|
||||
### `fixed`
|
||||
|
||||
Indicates fixed value to element or attribute.
|
||||
|
||||
Optional.
|
||||
Optional; ignored if 'default' is present.
|
||||
|
||||
Only allowed for simple elements or attributes.
|
||||
|
||||
### `use`
|
||||
|
||||
Indicates that the attribute is required.
|
||||
|
||||
Optional.
|
||||
Optional; if not present by default is `optional`.
|
||||
|
||||
Only `required` is valid as value.
|
||||
Allowed uses:
|
||||
|
||||
- `optional`.
|
||||
- `required`.
|
||||
- `prohibited`.
|
||||
|
||||
### `restriction`
|
||||
|
||||
Indicates accepted constrained values for element or attribute.
|
||||
Indicates accepted constrained values for attribute.
|
||||
|
||||
Optional; if present, must contain at least one constrain.
|
||||
|
||||
Not allowed for 'empty' and 'no_text' elements.
|
||||
Optional; if present, must contain at least one constrain and attribute
|
||||
`datatype` is ignored.
|
||||
|
||||
Allowed constrains:
|
||||
|
||||
|
@ -312,7 +329,7 @@ Allowed constrains:
|
|||
carriage returns) is handled; accepted values are
|
||||
`preserve|replace|collapse`.
|
||||
|
||||
### `attribute`
|
||||
### `attributes`
|
||||
|
||||
Indicates a list of attributes for an element.
|
||||
|
||||
|
@ -353,7 +370,7 @@ Valid value is non negative integer.
|
|||
|
||||
### `group`
|
||||
|
||||
Indicates group name.
|
||||
References group name.
|
||||
|
||||
Optional.
|
||||
|
||||
|
@ -380,9 +397,9 @@ Indicates elements for schema.
|
|||
|
||||
Mandatory.
|
||||
|
||||
### `attributes`
|
||||
### `attributeElements`
|
||||
|
||||
Indicates attributes for schema.
|
||||
Indicates attributes elements for schema.
|
||||
|
||||
Optional.
|
||||
|
||||
|
@ -392,6 +409,15 @@ Indicates schema general information.
|
|||
|
||||
Mandatory.
|
||||
|
||||
## References
|
||||
|
||||
- "XML Schema Reference", [W3ref]
|
||||
- "XML Schema Tutorial", [W3Schools].
|
||||
- "XSD Tutorial", [Tutorials Point].
|
||||
|
||||
[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
|
||||
[reStructuredText]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.rst
|
||||
[W3ref]: https://www.w3schools.com/xml/schema_elements_ref.asp
|
||||
[W3Schools]: https://www.w3schools.com/xml/schema_intro.asp
|
||||
[Tutorials Point]: https://www.tutorialspoint.com/xsd/
|
||||
|
|
Loading…
Reference in New Issue