XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] 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]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS