Answer the question
In order to leave comments, you need to log in
Methods or approaches for designing systems based on specification in XML?
I am designing a python library for export\import\serialization\de-serialization of data in a given format. The data format is described by a fairly extensive specification based on XML\XSD, the data itself is also in XML. At first I thought to implement each entity as a separate class, but there are quite a few entities, moreover, some of the entities can be both nested and exist separately.
For example:
<data>
<some_container>
<some_verb>...</some_verb>
<some_noun>
<profile1>
<address>...</address>
<other_data>...</other_data>
</profile1>
...
</some_noun>
</some_container>
</data>
Answer the question
In order to leave comments, you need to log in
To fully work with XML, you will need about four libraries / classes
1. DOM
2. XSD
3. XSL
4. xPath
Sometimes xPath is included in DOM libraries, sometimes it exists separately.
DOM is used for import, XSD is immediately set on the loaded document to check the validity of the structure.
The export is usually done without any validation, or extra XSD validation can be done before the export.
Serialization and deserialization must be done by the DOM parser (nothing else).
XSL and xPath come in handy when you need to export to a non-original file format (HTML, XML of another structure, csv, rtf, and more), or import from arbitrary XML formats. The procedure is simple - we set the XSL transformer on the source document and get the desired output.
I can't recommend specific libraries because I don't work with python.
Select the best from the list
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question