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

Re: How to represent a "cost" in XML?

  • From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
  • To: "Costello, Roger L." <costello@mitre.org>,"xml-dev@l..." <xml-dev@l...>
  • Date: Wed, 26 Sep 2018 21:47:59 -0400

Re:  How to represent a "cost" in XML?
Would you accept using the term Price? UBL has both a structured price and an unstructured price:

http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/All-UBL-2.2-Documents.html#Table-Price.Details

http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/All-UBL-2.2-Documents.html#Table-UnstructuredPrice.Details

Note that UBL uses the Core Component Technical Specification 2.01 for its Core Component Types, one of which is "Amount" which includes currency:

http://docs.oasis-open.org/ubl/os-UBL-2.2/mod/summary/reports/All-UBL-2.2-Documents.html#UDT-Amount.Type

But from your email, although you say "cost", I wonder if simply the CCTS "Amount" will satisfy your needs. Note that "Amount" also includes an attribute for the version of the currency code list from which your code is being used. You may not be using "RON" currency, but a good example of versioning the code list is that a 2005 RON is worth over 200,000 1951 RON.

Amounts can be used for costs, for prices, for discounts, for taxes, for anything with a currency ... which isn't always a "cost".

In the future if you are looking for business semantics for XML or JSON, UBL defines a semantic library that is being adopted around the world for business documents:

https://en.wikipedia.org/w/index.php?title=Universal_Business_Language

I hope this is helpful.

. . . . . Ken

At 2018-09-26 21:44 +0000, Costello, Roger L. wrote:
Hi Folks,

I would like to represent in XML the cost of something.

Here's one way to represent it:

<Cost currency="USD">8.95</Cost>

If you didn't want to use attributes (or mixed content), how would you represent it?

Would you represent it like this:

<Cost>
<Currency>USD</Currency>
<Value>8.95</Value>
</Cost>

I do not like that representation because it introduces a fake <Value> element.

Perhaps you would represent it by turning things inside out:

<Value>
<Currency>USD</Currency>
<Cost>8.95</Cost>
</Value>

I'm not sure I even know what that means.

Sigh.

Any economists out there? Please do tell: what is "cost"?

Cost seems to have (at least) two components: a number and an indication of what system of money the number is based on. The "system of money" is the currency. What about the number; what is it? What label do you give to the number? When you talk about the number, what words do you use?

/Roger

--
Contact info, blog, articles, etc. http://www.CraneSoftwrights.com/x/ |
Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Streaming hands-on XSLT/XPath 2 training class @ US$45 (5 hours free) |



[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.