Re: [xml-dev] Help with XML anti pattern

From
Norman Gray <>
To
William David Velasquez <>
Date
2021-11-23T21:49:58Z
ID
<>
Thread
Re: [xml-dev] Help with XML anti pattern
William, greetings.

On 23 Nov 2021, at 18:21, William David Velasquez wrote:

> <ext:UBLExtension>
> <ext:ExtensionContent>
> <SWMaker>
> <SWMakerInfo>
> <Name>FirstName</Name>
> <Value>Erick</Value>
> <Name>LastName</Name>
> <Value>Rich</Value>
> <Name>SWName</Name>
> <Value>FancySoft v.1.0</Value>
> </SWMakerInfo>
> </SWMaker>
> </ext:ExtensionContent>
> </ext:UBLExtension>

and

> I'm expecting customer won't be open to accept the change, because the 
> actual structure can do the work.
>
> So, what arguments would you use to convince the customer?

One possible tack is to note that the key-value structure is highly 
unidiomatic XML, so XML tools will always work poorly with it (you're 
mentioned a couple of examples of what one might call 'impedance 
mismatches' already), and it is thus building in technical debt by 
design.

If the context is such that there is a set of key-value pairs being 
serialised in this way, for in-principle arbitrary keys, then the 
conclusion may be that XML is a poor way of doing this serialisation.  
Use JSON instead (cf the discussion on this list in the last few weeks). 
  I think this is quite a good example of XML not being the right answer 
for every problem, and indeed this is the sort of solution that gives 
XML a bad name.

If the conclusion is that there are key-value pairs, and this 
serialisation has got to have pointy brackets in it (kos that's what the 
kool kidz are doing these days), then potentially use plist format [1].  
I don't think anyone believes that .plist was a good Apple design 
decision, but there are at least libraries for it, and no-one has to 
waste their good energies trying to put a different shade of lipstick on 
this particular pig.

I see that there's at least some 'ext:' XML namespacing happening there, 
so another one surely wouldn't hurt.

(I don't think <Name>/<Value> is a great design, by the way)

Best wishes,

Norman


[1] https://en.wikipedia.org/wiki/Property_list

-- 
Norman Gray  :  https://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK