Author |
Message
|
fjb_saper |
Posted: Tue Dec 22, 2015 12:12 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
anon_kb wrote: |
Hi FJB,
Sorry but I still dont get about this If no namespace declaration is done the namespace will follow an autonumbering scheme
Declare it in esql
1. DECLARE namespace1 NAMESPACE 'http://www.openapplications.org/oagis/9';
DECLARE namespace2 NAMESPACE 'http://www.gic.site.com/oagis/9/site/1';
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
2. Assign
SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData; |
so if you did the 2 above things and did not use on top of it the XMLNSC.NameSpaceDecl your XML would look like this:
Code: |
<.....>
<NSX:Attachment xmlns:NSX="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</NSX:Attachment> |
Here X in NSX is the nth occurrence of a namespace.
The autonumbering scheme goes like NS1, NS2, NS3,...NSX...
The use of the XMLNSC.NameSpaceDecl allows you to control the appearance i.e. openapp:Attachement instead of NSX:Attachment and if repeated, not to declare the same namespace with different prefixes, or declare a default namespace (again for document namespace appearance, not assignment).
Hope this clears it up.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
anon_kb |
Posted: Tue Dec 22, 2015 12:24 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
Quote: |
so if you did the 2 above things and did not use on top of it the XMLNSC.NameSpaceDecl your XML would look like this:
Code: |
<.....>
<NSX:Attachment xmlns:NSX="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</NSX:Attachment> |
The use of the XMLNSC.NameSpaceDecl allows you to control the appearance i.e. openapp:Attachement instead of NSX:Attachment and if repeated, not to declare the same namespace with different prefixes, or declare a default namespace (again for document namespace appearance, not assignment).
Hope this clears it up.  |
Yes youre right. but for my expected output. it must be like this
Code: |
<.....>
<Attachment xmlns ="http://www.openapplicatiions.org/oagis/9'>contentof tstSQSData</Attachment> |
It really baffled me up since as what I have said as I do the mapping on other elements theres no problem on it except on this:
Quote: |
<SQSData>
<LOT>
<LotNumber>28501</LotNumber>
<DeliveryNumber>MANUAL DISPATCH</DeliveryNumber>
<ShipTo>SHIP</ShipTo>
<CODNIF> </CODNIF>
<CODNIP> </CODNIP>
<FECFAB>2015-10-12 00:00:00</FECFAB>
</LOT>
<LOT>
<LotNumber>28502</LotNumber>
<DeliveryNumber>MANUAL DISPATCH</DeliveryNumber>
<ShipTo>SHIP</ShipTo>
<CODNIF> </CODNIF>
<CODNIP> </CODNIP>
<FECFAB>2015-10-12 00:00:00</FECFAB>
</LOT>
</SQSData> |
for example if I map this part of input xml :
SET shipmentHeaderOutRef.namespace2:DocumentID.namespace1:ID = bsmHeaderInRef.DispatchingMode;
also if I want to get the Lot Number on SQSData.
SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData.LOT.LotNumber; It can map successfully without any problem on namespace SET shipmentHeaderOutRef.namespace1:Attachment = tstSQSData; but if i do this this gives me the problem.
Sorry for the questions, I understand your point but this situations baffle me.  |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Dec 22, 2015 12:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code: |
SET ref NAMESPACE = namespace1; |
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
anon_kb |
Posted: Tue Dec 22, 2015 2:42 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
fjb_saper wrote: |
The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code: |
SET ref NAMESPACE = namespace1; |
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...  |
So i'll be using the MOVE statement for this? anyway thanks for your advice fjb  |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Dec 22, 2015 7:25 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You don't need a MOVE statement if you use a FOR loop. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
anon_kb |
Posted: Thu Jan 14, 2016 4:49 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
fjb_saper wrote: |
The thing is that you require in your final document to have a default namespace for SQSData...
So you assign the SQSData (which at that point has not namespace assigned) to the Attachment.
However setting the appearance of a default namespace (XMLNSC.NameSpaceDecl) does not assign a default namespace...
You need to go recursively through your SQSData and assign the namespace:
Code: |
SET ref NAMESPACE = namespace1; |
moving your ref to each and everyone of the sub-elements of Attachment....
Hope this is now clear...  |
Hi again FJB,
I understand your point but I dont know how to implement it.. Sorry..
Anyway I tried to do this:
FOR input as InputRoot.XMLNSC.BSMERPShipmentConfirm.SQSData.*[] DO
SET shipmentHeaderOutRef.namespace1:Attachment = input
END FOR;
and stll same error..  |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jan 14, 2016 5:21 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en
Code: |
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.ElementType THEN
SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
END IF;
END FOR; |
Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
anon_kb |
Posted: Mon Jan 18, 2016 1:15 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
fjb_saper wrote: |
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en
Code: |
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.ElementType THEN
SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
END IF;
END FOR; |
Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...
Have fun  |
Hi FJB,
What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.
Thanks |
|
Back to top |
|
 |
maurito |
Posted: Mon Jan 18, 2016 1:59 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
anon_kb wrote: |
fjb_saper wrote: |
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en
Code: |
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.ElementType THEN
SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
END IF;
END FOR; |
Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...
Have fun  |
Hi FJB,
What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.
Thanks |
I guess it means that you need to do some investigation and get it to work. For that reason, FJB is saying
Quote: |
Or something like that. |
|
|
Back to top |
|
 |
anon_kb |
Posted: Mon Jan 18, 2016 4:01 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
maurito wrote: |
anon_kb wrote: |
fjb_saper wrote: |
You might want to read http://www-01.ibm.com/support/knowledgecenter/SSMKHH_9.0.0/com.ibm.etools.mft.doc/ak05030_.htm?lang=en
Code: |
FOR output as shipmentHeaderOutRef.namespace1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.ElementType THEN
SET output NAMESPACE = 'http://www.openapplicatiions.org/oagis/9';
END IF;
END FOR; |
Or something like that. And as we are talking about a default namespace it needs to be applied to all children in the loop, not just the loop members as the above code would do...
Have fun  |
Hi FJB,
What do you mean by that XMLNSC.ElementType? ElementType does not exist under XMLNSC. And also I look at the link and the input has been based for looping not the output. Sorry for this question.
Thanks |
I guess it means that you need to do some investigation and get it to work. For that reason, FJB is saying
Quote: |
Or something like that. |
|
Understand a bit. But kinda hard..aarghh
Code: |
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment = '';
SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment.(XMLNSC.NamespaceDecl)xmlns = sn1;
--SET OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:tEST = Environment.Variables.sqs;
SET OutputRoot.MQMD=InputRoot.MQMD;
DECLARE i INTEGER 1;
FOR output as OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.Element THEN
SET output NAMESPACE = 'http://www.openapplications.org/oagis/9';
END IF;
CREATE LASTCHILD OF OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[i]
VALUE bsmSQSData.LOT || '\' || CAST(i AS CHAR);
SET i = i + 1;
END FOR;
|
Tried this but no value for bsmSQSData.LOT appears on the output.  |
|
Back to top |
|
 |
timber |
Posted: Mon Jan 18, 2016 4:35 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Your coding style does not inspire confidence:
- Indentation is not consistent
- You are copying the MQMD header halfway through the code that constructs the output message body
I suggest that you step through the code in the debugger. Or take a user trace and look at what is happening. If you cannot do either of those, tell your boss that you don't have the tools to do the job. |
|
Back to top |
|
 |
anon_kb |
Posted: Mon Jan 18, 2016 7:00 pm Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
timber wrote: |
Your coding style does not inspire confidence:
- Indentation is not consistent
- You are copying the MQMD header halfway through the code that constructs the output message body
I suggest that you step through the code in the debugger. Or take a user trace and look at what is happening. If you cannot do either of those, tell your boss that you don't have the tools to do the job. |
Sorry for the coding style. Its just a test code that I've done. Dont have any debugger and cant even trace on my environment. Anyway thanks for your reply.
@FJB
Tried this code. And still no output, but error has been removed
Code: |
DECLARE i INTEGER 1;
FOR output as OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[] DO
IF FIELDTYPE(output)= XMLNSC.Element THEN
SET output NAMESPACE = 'http://www.openapplications.org/oagis/9';
SET output = bsmSQSData.*[i];
END IF;
SET i = i + 1;
END FOR; |
|
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jan 19, 2016 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
Why are you trying to do 5 things at once and each one undoing the previous one?
First assign your values. Then walk the tree assigning the namespace.
Assigning a value will undo the namespace assignment.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
anon_kb |
Posted: Tue Jan 19, 2016 9:45 pm Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
fjb_saper wrote: |
Why are you trying to do 5 things at once and each one undoing the previous one?
First assign your values. Then walk the tree assigning the namespace.
Assigning a value will undo the namespace assignment.
Have fun  |
Like this?
Code: |
CREATE LASTCHILD OF OutputRoot.XMLNSC.sn1:AcknowledgeShipment.sn1:Attachment.*[i]
VALUE bsmSQSData.LOT || '\' || CAST(i AS CHAR); |
Ohw I'm really sorry, its really vague on me now. Anyway thanks for your suggestion, I'm gonna try and try but I think I will be lacking out of time maybe I'll just reconstruct it manually on the code and I will just solve this issue in my free time..  |
|
Back to top |
|
 |
maurito |
Posted: Wed Jan 20, 2016 12:40 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
you can assign the namespace AND the value all at the same time. Look at the CREATE statement, it has NAMESPACE , NAME and VALUE clauses, amongst other things. |
|
Back to top |
|
 |
|