init: xsd
This commit is contained in:
parent
2afbeacd4f
commit
f5a16d824f
3 changed files with 14 additions and 2 deletions
|
@ -8,6 +8,8 @@ Le convertisseur est [converter.py](./converter.py).
|
|||
$ python converter.py l-systems.csv
|
||||
```
|
||||
|
||||
<!-- Pour valider : xmllint --schema data.xsd fichier.xml 1>/dev/null -->
|
||||
|
||||
## Rapport
|
||||
|
||||
<!-- TODO: Push le PDF uniquement quand il est finalisé. -->
|
||||
|
|
|
@ -49,7 +49,7 @@ class System:
|
|||
break
|
||||
|
||||
def __repr__(self):
|
||||
return pformat(self.__dict__, compact=True, width=120, sort_dicts=False)
|
||||
return pformat(object=self.__dict__, compact=True, width=120, sort_dicts=False)
|
||||
|
||||
def to_xml(self) -> XMLElement:
|
||||
"""Convert the current system into an XML element"""
|
||||
|
@ -126,8 +126,11 @@ if __name__ == "__main__":
|
|||
# Generate XML
|
||||
xml = lsystems_xml(lsystems)
|
||||
|
||||
# Add XML model declaration
|
||||
xml_string = '<?xml-model href="data.xsd"?>\n' + element_stringifier(xml).decode()
|
||||
|
||||
# Output XML
|
||||
dom = xml_parser(element_stringifier(xml))
|
||||
dom = xml_parser(xml_string)
|
||||
pretty_xml = dom.toprettyxml(encoding="UTF-8").decode()
|
||||
if args.output:
|
||||
with open(args.output, "w") as output_file:
|
||||
|
|
7
data.xsd
Normal file
7
data.xsd
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<!-- Root -->
|
||||
<xs:element name="lsystems"></xs:element>
|
||||
|
||||
</xs:schema>
|
Reference in a new issue