|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Extract XML as BLOB |
« View previous topic :: View next topic » |
Author |
Message
|
me.mehta |
Posted: Fri May 06, 2011 3:45 am Post subject: Extract XML as BLOB |
|
|
Novice
Joined: 30 Dec 2010 Posts: 11
|
Hi,
I am new in WMB I have come across a problem. I need to extract value of and element which itself is another XML.
<NS1:data xmlns:NS1="http:///ext.com/1-0">
<ns2:anotherxml ns2="http:///example.com/">
<somedata>
</somedata>
</ns2:anotherxml>
</NS1:data>
I have to get the anotherxml as a blob and store in the database. I have written following code
DECLARE options INTEGER BITOR(RootBitStream, ValidateContent, ValidateValue);
SET xml = ASBITSTREAM(Root.XMLNSC.NS1:data.*,,1208,,,,options);
But its giving exception saying 'Text:CHARACTER:No root element was found while writing the XML message'
Can you please help me knowing how it can be achieved?
Thanks,
Me |
|
Back to top |
|
 |
exerk |
Posted: Fri May 06, 2011 4:12 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
New you may be but please take note that there is a specific WMB forum and in future post WMB-related questions in that forum...
...moving this post. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 06, 2011 4:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
RootBitStream means "assume that the element passed in is the root of the tree".
Root.XMLNSC.NS1:data is not the root of the tree.
It is a folder.
Also, Root.XMLNSC.NS1:data.* is "the set of children of the data element".
As in, more than one element. Which may be the root of several trees, but is not the root of one tree. Or even a single folder.
So you need to make sure you know what you are asking the Broker to do, and that it makes sense at both the Broker level and at a fundemental XML level (no XML document is allowed to have more than one root element... ) |
|
Back to top |
|
 |
Vitor |
Posted: Fri May 06, 2011 4:28 am Post subject: Re: Extract XML as BLOB |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
me.mehta wrote: |
I am new in WMB I have come across a problem. I need to extract value of and element which itself is another XML. |
The example document you've posted isn't 1 XML document inside another; it's a single document with 2 namespaces and perfectly straightforward.
You need to do 2 things:
1) Define the namespaces correctly within the ESQL so that the <data> & <anotherxml> (which I repeat doesn't look like another document to me) can be located correctly by the parser
2) Code the ESQL correctly so that the children of <data> are identified to the ABITSREAM function - that construction isn't doing what you think it is.
As with so many things, a user trace will provide you with valuable information as to what your code is doing.
If the example you've posted is just that, an example, and the "real" XML really does have 1 XML document inside another then you've got problems because that's not a well formed piece of XML. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|