Author |
Message
|
jefflowrey |
Posted: Mon Feb 26, 2007 8:38 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 8:40 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
The Input Databody is not having any name space and under name body the elements could be any kind of name. it is not in the same order. Pls let me know how to add the subelement of <databody> from input to the output under <databody>. the output is having name space like
SET OutputRoot.XMLNS.inpns:MessageHDR.(XML.NamespaceDecl)xmlns = 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd';
SET OutputRoot.XMLNS.inpns:MessageHDR.inpns:User = Input...;
SET OutputRoot.XMLNS.inpns:MessageHDR.inpns:PartnerBillingID = Input....;
How can I add the subelement of <DATABODY> FROM MY INPUT TO MY OUTPUT.
OutputRoot .XMLNS.inpns:MessageHDR.inpns:DATABody = < Here I need to add all the subelement of my DATABODY FROM INPUT>
Pls
Bhaski. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Feb 26, 2007 8:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bhaski wrote: |
Pls let me know how to add the subelement of <databody> from input to the output under <databody>. |
The link provided by jefflowrey includes a section on anonomous reference of elements and examples. All you're trying to do is reference all the sub elements in your input, adding them to the output. This is not tricky; there are a couple of methods you could select
If the manual doesn't help (which it should), Mr Google or the forum search show turn up some stuff. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 26, 2007 8:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Please post an example of the output message that you want to get. |
|
Back to top |
|
 |
vsr |
Posted: Mon Feb 26, 2007 8:59 am Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
I hope this should work :
SET OutputRoot.XMLNS.inpns:MessageHDR.inpns:DATABody[] = (SELECT T AS Order FROM InputRoot.XMLNS.MessageHDR.DATABODY[] AS T); |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 9:04 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi kimbert
This is my model out
<?xml version="1.0"?>
<MessageHDR xmlns= "http://tempuri.org/InBnd WrkStationHeaderXML.xsd">
<User />
<Filename>c:\test.txt</Filename>
<Applid>text</Applid>
<FileID>100</FileID>
<MessageDTL>
<First/>
<First/>
<First/>
<First/>
<First/>
<First/>
<second/>
<second>text</second>
<second/>
<second>corp</second>
<thrid>Anthony Montemorra</thrid>
<four>Anthony Montemorra</four>
<five/>
<six/>
</MessageDTL>
<DATABody>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>111</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
</DATABody>
</MessageHDR>
The subelement name could be anything and it is XML format. Today it is <ELEMENT></ELEMENT>,
TOmorrow it may be
<newElement></newElement>
Pls ignore if any case sensitive problem
Thanks
Bhaski. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Feb 26, 2007 9:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Right. Now I understand the problem.
- None of the elements in your input message have a namespace
- All of the elements in your output message have a namespace
You need to perform a deep walk of the input message and for each element at each level you need to
a) copy it to the output message
b) set its namespace to "http://tempuri.org/InBnd WrkStationHeaderXML.xsd"
You also need to put a default namespace declaration on the root node of the output message tree. |
|
Back to top |
|
 |
bhaski |
Posted: Mon Feb 26, 2007 9:59 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Kimbert
Can you Pls look into my previous message. I included everything , but when i add this subelement ( children ) of Databody, it is not accepting, cos the subelement is not included with namepsace, since it is unknown to me.
Okay Pls let me know
how to move the cursor from DATABODY consider that as a root
<DATABody>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>111</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
<ELEMENT>
<ELEMENT1_NAME>Entity Name</ELEMENT1_NAME>
<ELEMENT1_CODE>363</ELEMENT1_CODE>
<ELEMENT_GROUP_CODE>ADDINSURED</ELEMENT_GROUP_CODE>
</ELEMENT>
</DATABody>
to each and every element inside the <DATABODY>, tell me the first step and for first element, remaining I will make recursive function.
Bhaski. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Feb 27, 2007 1:14 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
|
Back to top |
|
 |
vsr |
Posted: Tue Feb 27, 2007 5:48 am Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
Try this:
Quote: |
DECLARE I INTEGER 1;
DECLARE J INTEGER 1;
DECLARE inpns NAMESPACE 'http://tempuri.org/InBnd WrkStationHeaderXML.xsd';
J = CARDINALITY (InputRoot.XMLNS.MyRequest.DATABODY.ELEMENT[]);
WHILE ( I < J)
SET OutputRoot.XMLNS.inpns:MessageHDR.DATABody[I] = InputRoot.XMLNS.MyRequest.DATABODY.ELEMENT[I] ;
END WHILE;
|
But we should be careful while copying the entire tree ;here both input and output tree have same format so we can safely use this code .
At the same time you would have tried different things in the esql - I guess it won't take as much time time as you posted your replies . It's a ESQL basic thing
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac20420_.htm |
|
Back to top |
|
 |
bhaski |
Posted: Tue Feb 27, 2007 6:32 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hello all
I don't know the element name inside the <DATABODY> in the input file. there is some xml element inside the DATABODY. When I am copying the whole subelement of DATABODY, i am getting some problem with namespace. So pls let me know how to read the unknown element in my case with the about sample input? Can you Pls show me with ESQL sample?
Bhaski. |
|
Back to top |
|
 |
vsr |
Posted: Tue Feb 27, 2007 6:52 am Post subject: |
|
|
Centurion
Joined: 04 Apr 2006 Posts: 104
|
Quote: |
When I am copying the whole subelement of DATABODY, i am getting some problem with namespace. |
How do you know you are getting some problem ? How do you know that the problem is with namespace ? What are the methods you tried? Paste your code and place a trace node after the compute node and paste the trace and error code too ...
I suggest try reading about xml-namespaces and working with XMLNS parser from the information center. |
|
Back to top |
|
 |
bhaski |
Posted: Fri Mar 09, 2007 1:55 pm Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
Hi friends
I have done this by using AsisElement of XML after convertering a String.
Thanks for your effort and ideas
Bhaski. |
|
Back to top |
|
 |
kimbert |
Posted: Sat Mar 10, 2007 12:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Hmmm. What exactly did you do? |
|
Back to top |
|
 |
bhaski |
Posted: Tue Mar 20, 2007 9:01 am Post subject: |
|
|
 Voyager
Joined: 13 Sep 2006 Posts: 78 Location: USA
|
I just added all the element inside the databody Using AsisElement.
DECLARE options INTEGER BITOR(FolderBitStream, ValidateContent,
ValidateValue);
DECLARE ref REFERENCE TO InputRoot.XMLNS.MyRequest .Request.DATABODY;
DECLARE myString CHARACTER CAST(ASBITSTREAM(ref,,1208,,,,options) AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);
SET OutputRoot.XMLNS.inpns:MessageHDR.inpns:DATABODY.(XML.AsisElementContent) =
Thank you all for the support
Love and Pray
Bhaski. |
|
Back to top |
|
 |
|