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

From
Liam R. E. Quin <>
To
William David Velasquez <>, XML Developers List <>
Date
2021-11-23T22:50:14Z
ID
<>
Thread
Re: [xml-dev] Help with XML anti pattern
On Tue, 2021-11-23 at 13:21 -0500, William David Velasquez wrote:
> 
> I'm asking for your help, because we'll have a meeting with the 
> contractor and I need arguments to convince them of changing to a
> "Natural" XML structure like this:
> 
> > <SWMaker>
> > <SWMakerInfo>
> > <FirstName>Erick</FirstName>
> > <LastName>Rich</LastName>
> > <SWName>FancySoft v.1.0</SWName>
> > </SWMakerInfo>
> > </SWMaker>

The first question is whether there will ever be field names that are
not legal XML element names. In that case, Name/Value work better.

If you stick with Name/Value, i second Michael  Kay's suggestion of a 
wrapper element for each pair. That would also allow multiple values,
e.g. for different languages:
<Pair>
  <Name>MonthOfBirth</Name>
  <Value xml:lang="en">January</Value>
  <Value xml:lang="pt">Janeiro</Value>
</Pair>
potentially with <Label> elements if needed, for a human-readable
version of the field name in each language.

As for attributes, ask if you'll ever need markup -- including e.g.
ruby for Chinese or Japanese -- inside a value; if so, you need the
text in element content.

Liam


-- 
Liam Quin, Paligo AB
https://www.delightfulcomputing.com/
 http://www.fromoldbooks.org