How to describe a list of simple values in XML?

amallesssum

New Member
I'm trying to come up with a schema for both an XML format and a JSON format, in which a pretty flexible data model can be nested. One of the joys of JSON is that, despite its lack of schema, it allows a surprising accurate model using the syntax alone without having to resort to "conventions" over how a specific piece of my model is represented. For instance, I can represent a list of simple values as a JSON array:\[code\]{"list": [1, 2, "Hello", { "name":"irrelevant" }, 5, 6]}\[/code\]whereas in XML I have to wrap each value in its own child element:\[code\]<list> <value>1</value> <value>2</value> <value>Hello</value> <object name="irrelevant" /> <value>5</value> <value>6</value></list>\[/code\]I have to be quite flexible in what I allow. For instance, a list should be able to contain the type of values a JSON list contains (and in general be untyped). I bet my lack of use of namespaces makes my prior example pretty error prone.Are there more elegant ways to describe a list of simple values in XML?
 
Back
Top