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, Yet Another Schema Definition
|
||||||
|
|
||||||
YASD is a YAML format for human writable XSDs (XML Schema Definition), humans
|
YASD is a YAML format for human writable XSDs (XML Schema Definition), humans
|
||||||
|
@ -22,7 +26,7 @@ flowchart LR
|
||||||
sample --- |from| YASD3([YASD])
|
sample --- |from| YASD3([YASD])
|
||||||
YASD3 --> |to| XML([XML])
|
YASD3 --> |to| XML([XML])
|
||||||
document --- |from| YASD4([YASD])
|
document --- |from| YASD4([YASD])
|
||||||
YASD4 --> |to| MD([Markdown])
|
YASD4 --> |to| RST([reStructuredText])
|
||||||
man --- |prints| README
|
man --- |prints| README
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -32,11 +36,11 @@ To better understad what YASD does, see the inputs and outputs:
|
||||||
|
|
||||||
- Input: human workable schema in [YASD].
|
- Input: human workable schema in [YASD].
|
||||||
- Output: computer processable schema in [XSD].
|
- Output: computer processable schema in [XSD].
|
||||||
- Output: human readable documentation in [Markdown].
|
- Output: human readable documentation in [reStructuredText].
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
[TOC]
|
\[TOC\]
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ To better understad what YASD does, see the inputs and outputs:
|
||||||
elements:
|
elements:
|
||||||
- ELMT
|
- ELMT
|
||||||
...
|
...
|
||||||
attributes:
|
attributeElements:
|
||||||
- ATTR
|
- ATTR
|
||||||
...
|
...
|
||||||
groups:
|
groups:
|
||||||
|
@ -67,20 +71,19 @@ To better understad what YASD does, see the inputs and outputs:
|
||||||
description: Element description
|
description: Element description
|
||||||
type: simple|empty|no_text|no_elements|mixed
|
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
|
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
|
attributes:
|
||||||
fixed: a_value
|
- ref: attribute_name
|
||||||
restriction:
|
use: optional|required|prohibited
|
||||||
CONSTRAIN
|
- group: group_name
|
||||||
...
|
|
||||||
attribute:
|
|
||||||
- attribute_name
|
|
||||||
...
|
...
|
||||||
children_order: all|choice|sequence
|
children_order: all|choice|sequence
|
||||||
children:
|
children:
|
||||||
- name: element_name
|
- ref: element_name
|
||||||
maxOccurs: INTEGER
|
maxOccurs: INTEGER|unbounded
|
||||||
|
minOccurs: INTEGER
|
||||||
|
- group_ref: group_name
|
||||||
|
maxOccurs: INTEGER|unbounded
|
||||||
minOccurs: INTEGER
|
minOccurs: INTEGER
|
||||||
- group: group_name
|
|
||||||
...
|
...
|
||||||
|
|
||||||
### Attribute (ATTR) structure
|
### 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
|
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
|
default: a_value
|
||||||
fixed: a_value
|
fixed: a_value
|
||||||
use: required
|
|
||||||
restriction:
|
restriction:
|
||||||
CONSTRAIN
|
- CONSTRAIN
|
||||||
...
|
...
|
||||||
|
|
||||||
### Group (GRPS) structure
|
### Group (GRPS) structure
|
||||||
|
@ -101,7 +103,7 @@ To better understad what YASD does, see the inputs and outputs:
|
||||||
attribute_group: true|false
|
attribute_group: true|false
|
||||||
children_order: all|choice|sequence
|
children_order: all|choice|sequence
|
||||||
children:
|
children:
|
||||||
- name: element_name
|
- ref: element_or_attribute_name
|
||||||
maxOccurs: INTEGER|unbounded
|
maxOccurs: INTEGER|unbounded
|
||||||
minOccurs: INTEGER
|
minOccurs: INTEGER
|
||||||
|
|
||||||
|
@ -141,7 +143,7 @@ Mandatory.
|
||||||
|
|
||||||
### `name`
|
### `name`
|
||||||
|
|
||||||
Indicates element or attribute name.
|
Indicates element, attribute or group name.
|
||||||
|
|
||||||
Mandatory.
|
Mandatory.
|
||||||
|
|
||||||
|
@ -156,6 +158,12 @@ Naming rules:
|
||||||
periods
|
periods
|
||||||
- Element names cannot contain spaces
|
- Element names cannot contain spaces
|
||||||
|
|
||||||
|
### `ref`
|
||||||
|
|
||||||
|
References element or attribute by name.
|
||||||
|
|
||||||
|
Mandatory.
|
||||||
|
|
||||||
### `description`
|
### `description`
|
||||||
|
|
||||||
Indicates element or attribute description in human readable form.
|
Indicates element or attribute description in human readable form.
|
||||||
|
@ -172,21 +180,23 @@ Allowed types:
|
||||||
|
|
||||||
- `simple`. Only text node allowed.
|
- `simple`. Only text node allowed.
|
||||||
- `empty`. Only attributes allowed.
|
- `empty`. Only attributes allowed.
|
||||||
- `no_text`. No text nodes allowed.
|
- `no_text`. No children text nodes allowed.
|
||||||
- `no_elements`. No children elements allowed.
|
- `no_elements`. No children elements allowed.
|
||||||
- `mixed`. Children elements, text node and attributes allowed.
|
- `mixed`. Children elements, text node and attributes allowed.
|
||||||
|
|
||||||
Chart:
|
Chart:
|
||||||
|
|
||||||
| type | children elements | text node | attributes |
|
| type | elements | text | attributes |
|
||||||
|------------|:-----------------:|:---------:|:----------:|
|
|-------------|:--------:|:----:|:----------:|
|
||||||
|simple | ✗ | ✓ | ✗ |
|
| simple | ✗ | ✓ | ✗ |
|
||||||
|empty | ✗ | ✗ | ✓ |
|
| empty | ✗ | ✗ | ✓ |
|
||||||
|no_text | ✓ | ✗ | ✓ |
|
| no_text | ✓ | ✗ | ✓ |
|
||||||
|no_elements | ✗ | ✓ | ✓ |
|
| no_elements | ✗ | ✓ | ✓ |
|
||||||
|mixed | ✓ | ✓ | ✓ |
|
| 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`
|
### `datatype`
|
||||||
|
|
||||||
|
@ -264,27 +274,34 @@ Indicates default value when element or attribute is empty.
|
||||||
|
|
||||||
Optional.
|
Optional.
|
||||||
|
|
||||||
|
Only allowed for simple elements or attributes.
|
||||||
|
|
||||||
### `fixed`
|
### `fixed`
|
||||||
|
|
||||||
Indicates fixed value to element or attribute.
|
Indicates fixed value to element or attribute.
|
||||||
|
|
||||||
Optional.
|
Optional; ignored if 'default' is present.
|
||||||
|
|
||||||
|
Only allowed for simple elements or attributes.
|
||||||
|
|
||||||
### `use`
|
### `use`
|
||||||
|
|
||||||
Indicates that the attribute is required.
|
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`
|
### `restriction`
|
||||||
|
|
||||||
Indicates accepted constrained values for element or attribute.
|
Indicates accepted constrained values for attribute.
|
||||||
|
|
||||||
Optional; if present, must contain at least one constrain.
|
Optional; if present, must contain at least one constrain and attribute
|
||||||
|
`datatype` is ignored.
|
||||||
Not allowed for 'empty' and 'no_text' elements.
|
|
||||||
|
|
||||||
Allowed constrains:
|
Allowed constrains:
|
||||||
|
|
||||||
|
@ -312,7 +329,7 @@ Allowed constrains:
|
||||||
carriage returns) is handled; accepted values are
|
carriage returns) is handled; accepted values are
|
||||||
`preserve|replace|collapse`.
|
`preserve|replace|collapse`.
|
||||||
|
|
||||||
### `attribute`
|
### `attributes`
|
||||||
|
|
||||||
Indicates a list of attributes for an element.
|
Indicates a list of attributes for an element.
|
||||||
|
|
||||||
|
@ -353,7 +370,7 @@ Valid value is non negative integer.
|
||||||
|
|
||||||
### `group`
|
### `group`
|
||||||
|
|
||||||
Indicates group name.
|
References group name.
|
||||||
|
|
||||||
Optional.
|
Optional.
|
||||||
|
|
||||||
|
@ -380,9 +397,9 @@ Indicates elements for schema.
|
||||||
|
|
||||||
Mandatory.
|
Mandatory.
|
||||||
|
|
||||||
### `attributes`
|
### `attributeElements`
|
||||||
|
|
||||||
Indicates attributes for schema.
|
Indicates attributes elements for schema.
|
||||||
|
|
||||||
Optional.
|
Optional.
|
||||||
|
|
||||||
|
@ -392,6 +409,15 @@ Indicates schema general information.
|
||||||
|
|
||||||
Mandatory.
|
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
|
[YASD]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.yaml
|
||||||
[XSD]: https://gitlab.com/amlengua/apal/esquema/-/blob/main/apal.xsd
|
[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