ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: XSD decimal

Post new topic  Reply to topic
 IIB9: XSD decimal « View previous topic :: View next topic » 
Author Message
akil
PostPosted: Tue Oct 27, 2015 6:12 am    Post subject: IIB9: XSD decimal Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

I've a XSD that defines an element to be of type xsd:decimal.

Code:

                           <xsd:element name="BillingAmount">
                               <xsd:annotation>
                                  <xsd:documentation>
                                     This field contains the
                                     amount in the card
                                     account currency
                                  </xsd:documentation>
                               </xsd:annotation>
                               <xsd:simpleType>
                                  <xsd:restriction
                                     base="xsd:decimal">
                                     <xsd:pattern
                                        value="\d{1,9}\.\d{2}">
                                     </xsd:pattern>
                                  </xsd:restriction>
                               </xsd:simpleType>
                            </xsd:element>


I set the value in ESQL

Code:

SET OutputRoot.XMLNSC.BillingAmountAmount = 100.00;


When I serialise it via ASBITSTREAM, I get the value as if the value was a float

Code:

<BillingAmount>1E+2</BillingAmount>


But when I change the ESQL to specifically use a decimal

Code:

SET OutputRoot.XMLNSC.BillingAmountAmount = CAST(100.00 AS DECIMAL);


I get the correct value

Code:

<BillingAmount>100.00</BillingAmount>


Isn't the parser supposed to use the data-type specified in the XSD when it calls ASBITSTREAM? What can I do to avoid writing CAST AS DECIMAL in ESQL everytime I need to use ta decimal data-type?
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
timber
PostPosted: Tue Oct 27, 2015 7:39 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

It's a fair question, but that is not how XMLNSC works. The writing of OutputRoot.XMLNSC is tree-driven, not model-driven. So if the tree contains a FLOAT then a FLOAT will be written, even if the xsd specifies a DECIMAL.

If you switch on validation in the output node, the inconsistency will be detected and will result in a validation error.
Back to top
View user's profile Send private message
mgk
PostPosted: Tue Oct 27, 2015 8:06 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

You can also use a DECIMAL literal value as well instead if the value is a constant to save having to do a CAST.

Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
akil
PostPosted: Wed Oct 28, 2015 12:29 am    Post subject: Reply with quote

Partisan

Joined: 27 May 2014
Posts: 338
Location: Mumbai

Hi

Thanks ..

So the tree creates a data-type basis the ESQL variable's data-type, as it does not have any reference to the schema at that point..

While a mapping node creates the tree basis the XML schema, as it does indeed have a reference to the schema..

Is there any way to give a reference to the schema to ESQL ?

Regards
Akhilesh
_________________
Regards
Back to top
View user's profile Send private message Visit poster's website
timber
PostPosted: Wed Oct 28, 2015 2:54 am    Post subject: Reply with quote

Grand Master

Joined: 25 Aug 2015
Posts: 1292

Quote:
Is there any way to give a reference to the schema to ESQL ?
Not for ESQL. But IIB is very flexible, and gives you several options:
- ESQL : Create any message tree structure you like. Does not have to conform to an XSD.
- Java : Same as ESQL by default. If you have xsds, you can generate JAXB classes and get an xsd-aware transformation language.
- Mapping node : Input and output message tree must always match an XSD.

Each has its advantages. Pick the one that suits your requirements.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: XSD decimal
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.