Re: Representing the components of a string in XML -- should delimiters be represented?

Thomas Passin <[email protected]> Sun, 26 Feb 2023 09:29:52 -0500
Newsgroups gmane.text.xml.devel
Message-ID <[email protected]>
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='+'/>
     ...

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: [email protected]
subscribe: [email protected]
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php