Author |
Message
|
neo_revolution |
Posted: Thu Jan 29, 2004 6:00 am Post subject: BITSTREAM |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
Hello,
I am getting Input as XML fomat. I need to convert a part of XML into BITSTREAM and insert into database. Like....
DECLARE blobMsg BLOB;
SET blobMsg = BITSTREAM(InputRoot.XML.PurchaseOrder.Details);
INSERT INTO Database.INVOICE VALUES(-, -, blobMsg);
But my entire message is being converting into BITSTREAM and being inserted into database. But I need only a part of my XML to be inserted.
Thx. |
|
Back to top |
|
 |
Meow |
Posted: Thu Jan 29, 2004 6:09 am Post subject: |
|
|
 Voyager
Joined: 25 Jun 2003 Posts: 95
|
try this...
copy the subtree into a new element.
ECLARE myCardinality INTEGER;
DECLARE myIndex INTEGER;
SET myIndex = 1;
SET myCardinality = CARDINALITY ("InputRoot"."XML"."Msg"."CharBody".*[]);
WHILE myIndex <= myCardinality DO
SET OutputRoot.XML.Record.*[myIndex] = "InputRoot"."XML"."Msg"."CharBody".*[myIndex];
SET myIndex = myIndex + 1;
END WHILE;
this would copy the
<Msg><CharBody><a>123</a><b>36346</b></CharBody></Msg>
the output would be
<Record><a>123</a><b>36346</b></Record>
have you tried the ATTACH and DETATCH functions? |
|
Back to top |
|
 |
neo_revolution |
Posted: Thu Jan 29, 2004 6:15 am Post subject: BITSTREAM |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
This looks good. But I don't want it to be attached to another tag like you mentioned <Record></Record>, I just need XML b/n two tags... If I do as you mentioned I am adding some extra element.
The problem is the data in the bitstream what I am getting is a variable data and I don't know what that is, can be XML but the structure is not known.
Thx |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jan 29, 2004 7:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
First off, use ASBITSTREAM instead of BITSTREAM for any version of WMQI later than 2.1 CSD02.
Second, you need to be a bit wary of arbitrarily taking a subsection of XML. If, for instance, I took all children of element "B" in the following XML, it would cause a problem.
<A>
<B>
<C>
<C1>value</c1>
<C2>value</c2>
</C>
<D>
<D1>value</D1>
<D2>value</D2>
</D>
</B>
</A>
Element B has two distinct children. If you tried to parse a bistream of everything contained within <B> and </B>, you would get a document with two roots (<C> and <D>)! _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
neo_revolution |
Posted: Thu Jan 29, 2004 7:28 am Post subject: BITSTREAM |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
I see the point..
I am passing child of <A>. Should not be any problem... I will check.
<A>
<B>
<C>
<C1>value</c1>
<C2>value</c2>
</C>
<D>
<D1>value</D1>
<D2>value</D2>
</D>
</B>
</A>
Thx |
|
Back to top |
|
 |
neo_revolution |
Posted: Fri Jan 30, 2004 7:17 pm Post subject: ASBITSTREAM |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
Can anyone give me how to use ASBITSTREAM... I tried to use but its giving me this error...
BIP2938E: An attempt was made to execute the non existent function or procedure 'ASBITSTREAM'. An attempt was made to execute the function or procedure 'ASBITSTREAM' but no such function or procedure has been defined. All functions and procedures must be defined in the node that uses them. Examine and correct the SQL program
Thanks in advance. |
|
Back to top |
|
 |
EddieA |
Posted: Fri Jan 30, 2004 8:51 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
ABITSTREAM was introduced with CSD3 on V2.1. Sounds like you are at a lower level.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
neo_revolution |
Posted: Tue Feb 03, 2004 8:57 am Post subject: ASBITSTREAM |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
Hello,
This is what I did to convert a sub-xml tree to bitstream, so as I can convert it into BLOB to store in DB2 database...
DECLARE msgBlob BLOB;
SET msgBlob = ASBITSTREAM(InputRoot.XML.Body.Invoice OPTIONS FolderBitStream);
INSERT INTO ......
But I am unable to fine good documentation to see what ASBITSTREAM can do.
Do anyone have idea?
Thanks in advance. |
|
Back to top |
|
 |
dhincali |
Posted: Tue Feb 03, 2004 9:57 am Post subject: |
|
|
Novice
Joined: 29 Dec 2003 Posts: 22
|
|
Back to top |
|
 |
neo_revolution |
Posted: Tue Feb 03, 2004 12:26 pm Post subject: |
|
|
Voyager
Joined: 21 Oct 2003 Posts: 80 Location: NJ
|
|
Back to top |
|
 |
|