XML / XSD: what is a good format for amounts?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers XML / XSD: what is a good format for amounts?
# 1  
Old 03-12-2011
XML / XSD: what is a good format for amounts?

Suppose I have a XSD definition of amount:
Code:
<xs:element name="Amount" type="amount>

And the amounts themselves are given in the following format in the XML:
Code:
<amount>1.000.00</amount>

In other words, the thousand separator and the decimal point are the same.

Does this require that the parser understands that only the last period (.) is the decimal point and that all other periods (.) are thousand separators? Is there a definition that I should be using instead to have a decimal point as output only and no thousand separator?

Last edited by figaro; 03-12-2011 at 10:31 AM.. Reason: Typo & added tags for clarity
# 2  
Old 03-12-2011
Since you have not provided us with the definition of the custom amount type there is no way anybody can answer your question.
# 3  
Old 03-12-2011
Thank you for your answer. I checked and found the following:
Code:
simpleType amount
type restriction of xs:decimal
facets totalDigits 20
fractionDigits 2
source <xs:simpleType name="amount">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2"/>
<xs:totalDigits value="20"/>
</xs:restriction>
</xs:simpleType>

Is that what you mean?
# 4  
Old 03-12-2011
Yes, that is what I was looking for. Thanks.

For xs:decimal, the decimal separator is always a point (.) and no separation at the thousand mark may be added. There is no support for scientific notation.

Valid values include: 123.456, +1234.456, -1234.456, -.456, or -456.

Invalid values include: 1 234.456 (spaces are forbidden), 1234.456E+2 (scientific notation—E+2—is forbidden), + 1234.456 (spaces are forbidden), or +1,234.456 (delimiters between thousands are forbidden).

You will have to use a complexType if you want to include thousands separators (or hundreds in Lakh, etc.) and even then you will not be able to use a point (.) both as a decimal separator and a thousands separator.
This User Gave Thanks to fpmurphy For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Validating XML file using XSD in UNIX

Hi, I have a xml file and a xsd file(xml schema file). Here using unix script i wanted to validate the xml file by referring to xsd file. The validation is in terms of Datatype,Field length and null values. If the data present in the xml file is not matching in terms of datatype,field length... (3 Replies)
Discussion started by: shree11
3 Replies

2. Shell Programming and Scripting

Validate xml agaist xsd is ksh

how do i validate xml agaist xsd is ksh? (1 Reply)
Discussion started by: LiorAmitai
1 Replies

3. Shell Programming and Scripting

Validating XML against XSD

Hi Frnds I want to validate an xml file against its xsd using KSH. But dont have any idea on how to proceed:confused:.. Please help me with your ideas.. Thanks in advance.... (3 Replies)
Discussion started by: balesh
3 Replies

4. Shell Programming and Scripting

Help required converting XSD to XML file in PERL

Hi, Please find below the xsd. <?xml version="1.0" encoding="ISO-8859-1" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="fruitorder"> <xs:complexType> <xs:sequence> <xs:element name="orderperson"... (2 Replies)
Discussion started by: vanitham
2 Replies

5. Solaris

Format output not good

Hi All, When i type format in solaris , I get the below output .This is not clear. Pl explain why it is looking like this. 0. c6t600A0B800067BCDE000002A64B15CBB4d0 <SUN-LCSM100_F-0735 cyl 12798 alt 2 hd 64 sec 64> /scsi_vhci/ssd@g600a0b800067bcde000002a64b15cbb4 ... (2 Replies)
Discussion started by: jegaraman
2 Replies

6. Shell Programming and Scripting

XMLLINT COMMAND IN UNIX TO VALIDATE XML AGAINST XSD

Hi i am baby to unix shell script. how do i validate xml agaist xsd and transforms xml using xslt. Thanks Mohan (2 Replies)
Discussion started by: mohan.cheepu
2 Replies

7. Shell Programming and Scripting

XML format

Please help to convert the file which is tab separated into xml format 'Date' 'ID' 'Name' 'Time' 'Average Time' 2010-06-02 3 30943 00:00:50 1.39 2010-06-02 1 4545 00:01:03 2010-06-02 9 8203 00:01:00 (4 Replies)
Discussion started by: sandy1028
4 Replies

8. Shell Programming and Scripting

format xml

i want to grep to a file the numerator-denominator, 1.23456, 1.78901 from the following xml tags. <locks:pair xc:value="numerator/denominator" xc:type="Fields"> <mp:formFactor>1</mp:formFactor> <mp:quotation>numerator-denominator</mp:quotation> <mp:one>1.23456</mp:one>... (5 Replies)
Discussion started by: sigh2010
5 Replies

9. UNIX for Dummies Questions & Answers

compare two text files in a good format

I am writting a script where I have to Campare two text files. I have 3 text files named by s_list, s_list_new and dmg_file. where I have to compare s_list and s_list_new and whatever the unique values are in s_list I have to add that in the dmg_file. And the values they are only in s_list_new... (2 Replies)
Discussion started by: pareshan
2 Replies

10. UNIX for Advanced & Expert Users

Generating XML from XSD

Hi all, Am looking for a way to generate XML based on XSDs so that the final XML need not be validated against the XSDs again. Here is the part of the XSD <xsd:element name="first_element"> <xsd:complexType> <xsd:sequence> <xsd:element name="val"/> </xsd:sequence> ... (0 Replies)
Discussion started by: matrixmadhan
0 Replies
Login or Register to Ask a Question