[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Representing the components of a string in XML --should de

  • From: Thomas Passin <list1@tompassin.net>
  • To: xml-dev@lists.xml.org
  • Date: Sun, 26 Feb 2023 09:29:52 -0500

Re:  Representing the components of a string in XML --should de
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.