1

I used the xml / xml-schema example from here. When I decode the xml-string with the given schema, I get a nested dict as output:

{'@xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance', '@orderid': '889923', '@xsi:noNamespaceSchemaLocation': 'shiporder.xsd', 'orderperson': 'John Smith', 'shipto': {'name': 'Ola Nordmann', 'address': 'Langgt 23', 'city': '4000 Stavanger', 'country': 'Norway'}, 'item': [{'title': 'Empire Burlesque', 'note': 'Special Edition', 'quantity': 1, 'price': Decimal('10.90')}, {'title': 'Hide your heart', 'quantity': 1, 'price': Decimal('9.90')}]}

How is this notation called?

Or can someone help me out with a format description?

I think "@" means the attributes and the nested dicts are the complex types. But I can't read anything out of the example.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
testo
  • 1,052
  • 2
  • 8
  • 24
  • It is not clear what you are asking. Please clarify. – Yitzhak Khabinsky Jun 14 '21 at 16:41
  • The XML-Schema API has a Decoder and an encode function. You can decode XML to the data structure above and encode it back to XML. I cant find a description about the structure in the manual, so I hope it is something common. I need a name for further investigation. – testo Jun 14 '21 at 17:40
  • It's a variant of JSON with proprietary extensions to express the data type of things like `Decimal('10.90')`. I don't think it has a name, but there are lots of deviant JSON-like things around. – Michael Kay Jun 14 '21 at 20:52
  • I agree, its JSON and Decimal is a type defined by XML-Schema. But I don't want to do reverse engineering, I hope there is a documentation about the structure. – testo Jun 15 '21 at 07:02
  • 1
    I just found this: http://www.jsonml.org/ and it looks like the answer. – testo Jun 15 '21 at 07:05
  • http://wiki.open311.org/JSON_and_XML_Conversion/ – testo Jun 15 '21 at 07:08

0 Answers0