[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Representing the components of a string in XML --should delimiters be represented?
- From: Thomas Passin <list1@tompassin.net>
- To: xml-dev@lists.xml.org
- Date: Sun, 26 Feb 2023 09:29:52 -0500
On 2/26/2023 8:40 AM, Roger L Costello wrote:
Hi Folks,
I am creating an XML representation of the UNIX printf conversion
specifier. Here is a sample conversion specifier and its components:
% and . are delimiters. Should they be represented in XML?
Which of the following XML representations is better? If you assert
that one is better than another, please explain – in simple, concrete
terms – why it is better?
(a) Does not represent the delimiters in XML:
<conversion_specification>
<flag>+</flag>
<width>7</width>
<precision>3</precision>
<specifier>d</specifier>
</conversion_specification>
(b) Does represent the delimiters in XML:
<conversion_specification>
<start_of_specifier>%</start_of_specifier>
<flag>+</flag>
<width>7</width>
<start_of_precision>.</start_of_precision>
<precision>3</precision>
<specifier>d</specifier>
</conversion_specification>
/Roger
If you do not include the "%" and "." then they will have to be
understood by the user or using software. Only you know whether that
would be feasible. And of course there is other implicit knowledge,
such as that these parts should come in the same order as they appear in
the XML fragment, whether any of them can be omitted, etc. You haven't
included that kind of information.
You should probably write a little specification for this xml
representation. It might help you understand what really needs to be there.
Aside from the above, I'd use attributes - easier to read and more concise:
<conversion_specification>
<start char='%'/>
<flag char='+'/>
...
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]