| Author | 
		  Message
		 | 
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 1:51 am    Post subject: CREATING XML | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				<cardGraphicalData>4685 4055 5000 0116</cardGraphicalData>
 
    <cardGraphicalData>DSIT-555110123940003</cardGraphicalData>
 
    <cardGraphicalData>08/12</cardGraphicalData>
 
    <cardGraphicalData>214</cardGraphicalData>
 
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
 
 
 
I need to create the soap request exactly as the above xml.
 
Here the cardGraphicalData is repeated and has to be exactly the same .
 
 
 
I am not using (XMLNSC.Attribute) feature .
 
 
I want to make it as a string ..
 
 
will this work ?
 
 
DECLARE xmlString CHARACTER '<cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>';
 
		DECLARE I INTEGER 1;
 
		WHILE (I<16) DO 
 
			SET xmlString = xmlString||xmlString;
 
			SET I=I+1;
 
		END WHILE;		
 
		 
 
		DECLARE xmlBLOB BLOB CAST(xmlString AS BLOB CCSID InputRoot.Properties.CodedCharSetId ENCODING InputRoot.Properties.Encoding ); 
 
		CREATE LASTCHILD OF OutputRoot.XMLNSC.dex:createCardRequest DOMAIN('XMLNSC') PARSE(xmlBLOB ENCODING InputRoot.Properties.Encoding CCSID InputRoot.Properties.CodedCharSetId FORMAT 'XMLNSC' );
 
		
 
 
 
 
PLEASE ADVISE THE BEST WAY
 
   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mapa | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 2:00 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden 
  | 
		  
		    
			  
				What is your reason for not using XMLNSC to do this?
 
 
In my opinion that is the best way.
 
 
(Hint out of the blue: it is possible to set the namespace prefix to be xsi) | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 2:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				
   
	| mapa wrote: | 
   
  
	What is your reason for not using XMLNSC to do this?
 
 
In my opinion that is the best way.
 
 
(Hint out of the blue: it is possible to set the namespace prefix to be xsi) | 
   
 
 
 
 
Okay then how can i do that ??
 
 
I tried this way too...
 
		
 
		SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData.(XMLNSC.Attribute)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance';
 
 
		SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData.(XMLNSC.Attribute)xsi:nil ='true';
 
 
 
 
the second statement throws a warning saying that namespace constant  "xsi" has not been defined ... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mapa | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 2:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden 
  | 
		  
		    
			  
				You are missing this (apart from code tags in your post)
 
   
	| Code: | 
   
  
	
 
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
 
SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData.(XMLNSC.NamespaceDecl)xmlns:xsi = xsi;
 
 | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 2:50 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				How i am going to get this as it is :
 
 
<cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
 
can u give me the complete esql? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 2:57 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance'; 
 
		WHILE (I<16) DO 
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.NamespaceDecl)xmlns:xsi = xsi;
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.Attribute)xsi:nil ='true';		
 
			SET I=I+1;
 
		END WHILE;
 
 
will this work? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				i am confused if the second one is also a namespace declaration or an attribute ?
 
 
SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.NamespaceDecl)xsi:nil ='true';
 
 
 
OR 
 
 
SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.Attribute)xsi:nil ='true'; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mapa | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:12 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden 
  | 
		  
		    
			  
				Even if they do look alike, namespace declarations and attributes are not the same.
 
 
xsi:nil is an attribute as defined in the namespace "http://www.w3.org/2001/XMLSchema-instance"
 
 
Personally I would declare the xsi namespace on a higher level so I don't have to repeat it for every element. Most applications should be fine with that.
  Last edited by mapa on Tue Apr 24, 2012 3:17 am; edited 1 time in total | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:16 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				So , the code to generate this :
 
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
 
 
 
 
 
 
 
 
 
 
 
Should be : 
 
 
		DECLARE I INTEGER 1;
 
		DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance'; 
 
		WHILE (I<16) DO 
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.NamespaceDecl)xmlns:xsi = xsi;
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.Attribute)xsi:nil ='true';		
 
			SET I=I+1;
 
		END WHILE;
 
 
 
 
Note : first one is namespacedecl and another one is attribute .
 
 
 
Is this correct .. can u  give me yr final opinion on the code ? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mapa | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:18 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden 
  | 
		  
		    
			  
				Why not just try it    
 
 
But yes, that should be fine. 
 
(Still, I would prefer to declare xsi on a higher level if possible). | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | kimbert | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:23 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Council
 
 Joined: 29 Jul 2003 Posts: 5543 Location: Southampton 
  | 
		  
		    
			  
				
   
	| Quote: | 
   
  
	| I need to create the soap request exactly as the above xml.  | 
   
 
Please justify that statement. Why does it have to be *exactly* like that. Because I agree with this comment from mapa:
 
 
   
	| Quote: | 
   
  
	| Personally I would declare the xsi namespace on a higher level so I don't have to repeat it for every element. Most applications should be fine with that. | 
   
 
Can you explain why the receiving application needs the same namespace declaration on every tag? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | mapa | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:25 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden 
  | 
		  
		    
			  
				And please, learn how to use code-tags when posting code.
 
 
Not really part of this discussion, but you should use references as well instead of the full path starting with OutputRoot.XMLNSC.... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:34 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				
   
	| mapa wrote: | 
   
  
	Why not just try it    
 
 
But yes, that should be fine. 
 
(Still, I would prefer to declare xsi on a higher level if possible). | 
   
 
 
 
 
DUDE CHECK THIS SNIPPET FROM THE INFO CENTER :
 
 
DECLARE space1 NAMESPACE 'namespace1';
 
SET OutputRoot.XMLNSC.space1:root.(XMLNSC.NamespaceDecl)xmlns:ns1 = space1;
 
SET OutputRoot.XMLNSC.space1:root.space1:example = 'ABCDE';
 
 
This creates the following XML message: 
 
 
<ns1:root xmlns:ns1="namespace1">
 
    <ns1:example>ABCDE</ns1:example>
 
</ns1:root>
 
 
 
i dont want the namespace to occur 
 
 
it should be something like :
 
 
<root xmlns:ns1="namespace1">
 
    <example>ABCDE</example>
 
</root>
 
 
 
this is causing the confusion ..
 
 
so maybe this is better :
 
 
		DECLARE I INTEGER 1;
 
		DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance'; 
 
		WHILE (I<16) DO 
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.Attribute)xmlns:xsi = xsi;
 
 
			SET OutputRoot.XMLNSC.dex:createCardRequest.cardGraphicalData[I].(XMLNSC.Attribute)xsi:nil ='true';		
 
			SET I=I+1;
 
		END WHILE;
 
 
what say ?
 
 
 
 
   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:50 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				
   
	| kimbert wrote: | 
   
  
	
   
	| Quote: | 
   
  
	| I need to create the soap request exactly as the above xml.  | 
   
 
Please justify that statement. Why does it have to be *exactly* like that. Because I agree with this comment from mapa:
 
 
   
	| Quote: | 
   
  
	| Personally I would declare the xsi namespace on a higher level so I don't have to repeat it for every element. Most applications should be fine with that. | 
   
 
Can you explain why the receiving application needs the same namespace declaration on every tag? | 
   
 
 
 
 
Kimbert : this is  a soap request going to the webservice , who need this tag  to be repeated exactly 16 times as a part of some implementation on ther end . 
 
 
if would be better if you let me know what exactly you mean by higher level ? i have declared it outside the loop , only once .. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | my_mqmb | 
		  
		    
			  
				 Posted: Tue Apr 24, 2012 3:53 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Voyager
 
 Joined: 08 Jun 2011 Posts: 84
  
  | 
		  
		    
			  
				
   
	| Code: | 
   
  
	     <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/>
 
    <cardGraphicalData xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:nil = "true"/> | 
   
 
 | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |