Author |
Message
|
jsanchose2 |
Posted: Thu Feb 18, 2010 4:42 am Post subject: Changing the XML representation of boolean values |
|
|
Newbie
Joined: 18 Feb 2010 Posts: 5
|
The question is about a Message Set with only the XMLNSC domain.
In the XML wire format details panel I've changed the XML representation of boolean values from the default (0,1) to (false,true).
When I assign false to a boolean field XMLNSC parser throws an exception indicating 'cvc-datatype-valid.1.2: The value "FALSE" is not a valid value for the "YesNoIndicator" datatype.'
The base type of YesNoIndicator is xs:boolean
Changing the XSD is not a possible option.
Can somebody help me? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 18, 2010 3:28 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The XMLNSC parser does not use any of the information in the message set. It converts the mxsd files to xsds, and uses the xsds if validation is set to 'Content and Value'.
In XML Schema v1.0, only 'true' and 'false' ( lowercase and case-sensitive ) are allowed as the value of an attribute/element of type xs:boolean. The MRM XML parser allows you to parse and validate with that schema using the message set properties - but MRM XML does not claim to comply strictly with the W3C standard for XML Schema.
The XMLNSC parser is close to 100% compliant with the W3C XML Schema standard, and it applies the rules more strictly. That's usually a very good thing, although in your case it's probably an annoyance.
It's up to you what you decide to do about it. Your schema is not correct ( unless you are targeting the new XML Schema v1.1 standard ). If you *really* can't correct the schema, then you may be stuck with the not-quite-deprecated-but-not-very-good MRM XML parser. That's the problem with solutions whcih depart from published standards... |
|
Back to top |
|
 |
jsanchose2 |
Posted: Fri Feb 19, 2010 3:47 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2010 Posts: 5
|
The schema is using the v1.0
<?xml version="1.0" encoding="UTF-8"?>
The base type is xs:boolean
<xs:element name="PhysDlvryInd" type="YesNoIndicator"/>
<xs:simpleType name="YesNoIndicator">
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
and false value is set to the field in a compute node
SET Swf.Doc:PhysDlvryInd=false;
and the flow ends with the exception mentioned before
if I change the value false for 0 the flow ends correctly
This behavior does not tie-in with your explanation
Is it possible that Message Broker interprets xs:boolean as only 0,1 values?
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 19, 2010 11:11 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I was assuming that you were parsing, and that your input document was using '1' and '0' instead of 'true' and 'false'. Let me just check whether I have the facts correct now:
- your message flow needs to *output* an XML document
- you need to assign a boolean false value to a field which is of type xs:boolean in your xsd.
Please can you insert a Trace node just before the output node and post the relevant section ( within [code] tags, please ). |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Feb 19, 2010 2:17 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
SET Swf.Doc:PhysDlvryInd=false; |
This is different from
Code: |
SET Swf.Doc:PhysDlvryInd='false'; |
Remember that broker booleans are translated to the bitstream in CAPS.
This does not make for XML recognition of the broker's TRUE / FALSE boolean.
If you wanted to assign the char value false you should have used 'false'.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Fri Feb 19, 2010 3:04 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Remember that broker booleans are translated to the bitstream in CAPS. |
That's true for XML, XMLNS and MRM XML. However...
the XMLNSC parser takes care to write ESQL BOOLEAN fields as 'true' and 'false', in order to comply with the XML Schema specification. So jsanchose2 really does need to create a BOOLEAN field in the message tree. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 20, 2010 6:15 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kimbert wrote: |
Quote: |
Remember that broker booleans are translated to the bitstream in CAPS. |
That's true for XML, XMLNS and MRM XML. However...
the XMLNSC parser takes care to write ESQL BOOLEAN fields as 'true' and 'false', in order to comply with the XML Schema specification. So jsanchose2 really does need to create a BOOLEAN field in the message tree. |
Thanks Kimbert... I learned something more today  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jsanchose2 |
Posted: Mon Feb 22, 2010 12:49 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2010 Posts: 5
|
First of all in the pasted code, the output from the compute node that
writes the xml message. Note that we use the xmlns parser to create
namespace declaration with our own names (not the default NS1, NS2,
etc.), and following that the exception list from the output of a
ResetContentDescriptor node that changes the domain to XMLNSC for
validation.
The problem occurs with the boolean element PhysDlvryInd.
The set for this field is in lowercase (false) although in the trace it appears in uppercase (FALSE).
Thanks again.
Code: |
OUTPUT FROM COMPUTE NODE.
(0x01000010:ParserRoot):XMLNS = ( ['xmlns' : 0x3a1fe30]
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Document = (
(0x07000012:NamespaceDecl)xmlns:Doc = 'urn:swift:xsd:setr.010.002.01' (CHARACTER)
(0x01000000:Element )urn:swift:xsd:setr.010.002.01:SbcptOrdr = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:MsgId = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Id = (
(0x02000000:pcdata): = '99951000000004' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:CreDtTm = (
(0x02000000:pcdata): = '9999-12-31T00:00:00' (CHARACTER)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:MltplOrdrDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:InvstmtAcctDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:AcctId = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Prtry = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Id = (
(0x02000000:pcdata): = 'ECLR12409' (CHARACTER)
)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:OwnrId = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:NmAndAdr = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Nm = (
(0x02000000:pcdata): = 'FS/BANCAJA' (CHARACTER)
)
)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:IndvOrdrDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:OrdrRef = (
(0x02000000:pcdata): = '99951000000004' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:FinInstrmDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Id = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:ISIN = (
(0x02000000:pcdata): = 'LU0089639594' (CHARACTER)
)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:UnitsNb = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Unit = (
(0x02000000:pcdata): = 54.00000000 (DECIMAL)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:SttlmMtd = (
(0x02000000:pcdata): = 'APMT' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:IncmPref = (
(0x02000000:pcdata): = 'DRIP' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:ChrgDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Tp = (
(0x02000000:pcdata): = 'CHAR' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Amt = (
(0x03000000:Attribute):Ccy = 'EUR' (CHARACTER)
(0x02000000:pcdata ): = 0 (INTEGER)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:PhysDlvryInd = (
(0x02000000:pcdata): = FALSE (BOOLEAN)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:ReqdSttlmCcy = (
(0x02000000:pcdata): = 'USD' (CHARACTER)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:RltdPtyDtls = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Id = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:NmAndAdr = (
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Nm = (
(0x02000000:pcdata): = '249' (CHARACTER)
)
)
)
(0x01000000:Element)urn:swift:xsd:setr.010.002.01:Role = (
(0x02000000:pcdata): = 'INTR' (CHARACTER)
)
)
)
)
)
)
)
)
OUTPUT FROM RESETCONTENTDESCRIPTOR NODE
* ExceptionList
( ['MQROOT' : 0x8175e90]
(0x01000000:Name):RecoverableException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\DataFlowEngine\BasicNodes\ImbResetContentDescNode.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 609 (INTEGER)
(0x03000000:NameValue):Function = 'ImbResetContentDescNode::evaluate' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmResetContentDescriptorNode' (CHARACTER)
(0x03000000:NameValue):Name = 'EAI_FND_E_MXSUBS#FCMComposite_1_11' (CHARACTER)
(0x03000000:NameValue):Label = 'EAI_FND_E_MXSUBS.ResetContentDescriptor' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 2230 (INTEGER)
(0x03000000:NameValue):Text = 'Caught exception and rethrowing' (CHARACTER)
(0x01000000:Name ):ParserException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCParser.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 925 (INTEGER)
(0x03000000:NameValue):Function = 'ImbXMLNSCParser::parseLastChild' (CHARACTER)
(0x03000000:NameValue):Type = '' (CHARACTER)
(0x03000000:NameValue):Name = '' (CHARACTER)
(0x03000000:NameValue):Label = '' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 5009 (INTEGER)
(0x03000000:NameValue):Text = 'XML Parsing Errors have occurred' (CHARACTER)
(0x01000000:Name ):ParserException = (
(0x03000000:NameValue):File = 'F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCDocHandler.cpp' (CHARACTER)
(0x03000000:NameValue):Line = 550 (INTEGER)
(0x03000000:NameValue):Function = 'ImbXMLNSCDocHandler::handleParseErrors' (CHARACTER)
(0x03000000:NameValue):Type = 'ComIbmMQInputNode' (CHARACTER)
(0x03000000:NameValue):Name = 'EAI_FND_E_MXSUBS#FCMComposite_1_1' (CHARACTER)
(0x03000000:NameValue):Label = 'EAI_FND_E_MXSUBS.TL4_EAI_PETICION' (CHARACTER)
(0x03000000:NameValue):Catalog = 'BIPv610' (CHARACTER)
(0x03000000:NameValue):Severity = 3 (INTEGER)
(0x03000000:NameValue):Number = 5025 (INTEGER)
(0x03000000:NameValue):Text = 'A schema validation error has occurred while parsing the XML document' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '6000' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '1' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '1' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 2 (INTEGER)
(0x03000000:NameValue):Text = '784' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'cvc-datatype-valid.1.2: The value "FALSE" is not a valid value for the "YesNoIndicator" datatype.' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '/Root/XMLNSC/urn:swift:xsd:setr.010.002.01:Document/urn:swift:xsd:setr.010.002.01:SbcptOrdr/urn:swift:xsd:setr.010.002.01:MltplOrdrDtls/urn:swift:xsd:setr.010.002.01:IndvOrdrDtls/urn:swift:xsd:setr.010.002.01:PhysDlvryInd' (CHARACTER)
)
)
)
)
)
|
[/code] |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 22, 2010 1:27 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
In your first post, you said
Quote: |
The question is about a Message Set with only the XMLNSC domain. |
Now, after several exchanges, you reveal this:
Quote: |
Note that we use the xmlns parser to create
namespace declaration with our own names (not the default NS1, NS2,
etc.), and following that the exception list from the output of a
ResetContentDescriptor node that changes the domain to XMLNSC for
validation. |
The 'FALSE' is being received by the XMLNSC parser because the XMLNS parser is writing the BOOLEAN field as 'FALSE' which ( as explained above ) is not valid for xs:boolean.
The fix is simple : remove the RCD node, and build the message tree with the XMLNSC parser. |
|
Back to top |
|
 |
jsanchose2 |
Posted: Mon Feb 22, 2010 2:44 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2010 Posts: 5
|
Yes, you are right but if we change the compute node writing directly the
OutputRoot.XMLNSC tree, the value assigned to the fields is 'false' but the
namespaces are the default NS1, NS2, etc. and we want to generate the
XML with our own namespaces.
Copy/paste below the new message generated.
Can we construct the message directly with XMLNSC parser but generating customized namespaces?
Code: |
<NS1:Document xmlns:NS1="urn:swift:xsd:setr.010.002.01">
<NS1:SbcptOrdr>
<NS1:MsgId>
<NS1:Id>99951000000004</NS1:Id>
<NS1:CreDtTm>9999-12-31T00:00:00</NS1:CreDtTm>
</NS1:MsgId>
<NS1:MltplOrdrDtls>
<NS1:InvstmtAcctDtls>
<NS1:AcctId>
<NS1:Prtry>
<NS1:Id>ECLR12409</NS1:Id>
</NS1:Prtry>
</NS1:AcctId>
<NS1:OwnrId>
<NS1:NmAndAdr>
<NS1:Nm>FS/BANCAJA</NS1:Nm>
</NS1:NmAndAdr>
</NS1:OwnrId>
</NS1:InvstmtAcctDtls>
<NS1:IndvOrdrDtls>
<NS1:OrdrRef>99951000000004</NS1:OrdrRef>
<NS1:FinInstrmDtls>
<NS1:Id>
<NS1:ISIN>LU0089639594</NS1:ISIN>
</NS1:Id>
</NS1:FinInstrmDtls>
<NS1:UnitsNb>
<NS1:Unit>54.00000000</NS1:Unit>
</NS1:UnitsNb>
<NS1:SttlmMtd>APMT</NS1:SttlmMtd>
<NS1:IncmPref>DRIP</NS1:IncmPref>
<NS1:ChrgDtls>
<NS1:Tp>CHAR</NS1:Tp>
<NS1:Amt Ccy="EUR">0</NS1:Amt>
</NS1:ChrgDtls>
<NS1:PhysDlvryInd>false</NS1:PhysDlvryInd>
<NS1:ReqdSttlmCcy>USD</NS1:ReqdSttlmCcy>
<NS1:RltdPtyDtls>
<NS1:Id>
<NS1:NmAndAdr>
<NS1:Nm>249</NS1:Nm>
</NS1:NmAndAdr>
</NS1:Id>
<NS1:Role>INTR</NS1:Role>
</NS1:RltdPtyDtls>
</NS1:IndvOrdrDtls>
</NS1:MltplOrdrDtls>
</NS1:SbcptOrdr>
</NS1:Document> |
|
|
Back to top |
|
 |
mqjeff |
Posted: Mon Feb 22, 2010 5:19 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
jsanchose2 wrote: |
the namespaces are the default NS1, NS2, etc. and we want to generate the
XML with our own namespaces. |
Those are not namespaces. Those are namespace prefixes.
The characters used to form a namespace prefix is not syntactically or semantically meaningful in and of themselves. That is, it doesn't matter if you use 'NS1' or 'abc' or 'mydogisnamedspot' as the namespace prefix. It only matters that you use the right namespace prefix to indicate the semantically correct namespace.
This is a hugely important concept for you to understand when working with XML. It prevents you from doing monumentally dumb things like code to look for "SOAP:Body" to find the start of a WebService message body.
And, yes, of course you can determine your own namespace prefixes with XMLNSC. You just have to add them to the message tree. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 22, 2010 6:42 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
WMBDEV1 |
Posted: Mon Feb 22, 2010 7:39 am Post subject: |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
kimbert wrote: |
I know the topic structure is sometimes non-ideal, but if you go to the infocenter and search for 'XMLNSC namespace'
|
You just cant beat insider knowledge to help identify these cryptic searches!  |
|
Back to top |
|
 |
jsanchose2 |
Posted: Tue Feb 23, 2010 12:59 am Post subject: |
|
|
Newbie
Joined: 18 Feb 2010 Posts: 5
|
At last I have solved the problem. I know that the prefix written to represent the namespace is not important, but it's only an aesthetic question.
Usually I work with MRM domain and I have not experience with XMLNSC, the documentation has been a great help.
It's as easy as writing the following two sentences:
Code: |
DECLARE Doc NAMESPACE 'urn:swift:xsd:setr.010.002.01';
SET OutputRoot.XMLNSC.Doc:Document.(XMLNSC.NamespaceDecl)xmlns:Doc = Doc; |
My error was writing XML.NamespaceDecl when the correct is XMLNSC.NamespaceDecl
because using XMLNS domain the item XML.NamespaceDecl functions correctly.
Thanks for everything. |
|
Back to top |
|
 |
|