|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
XML Parsers question |
« View previous topic :: View next topic » |
Author |
Message
|
verdyan |
Posted: Tue May 01, 2007 7:28 am Post subject: XML Parsers question |
|
|
Novice
Joined: 24 May 2005 Posts: 13
|
Hello all,
I have a following scenario:
There a message flow that routes XML messages to multiple queues. This flow parses message with XMLNS parser then decides based on root tag and some of its attributes where to route it and writes it with MRM dictionary (by setting OutputRoot.Properties.MessegaSet, MessageType and MessageFormat). Couple weeks ago we ran into XML messages with \n between xml declaration and root tag, spaces between tags and spaces at the end of the document after root tag close. Now we have a problem handling this kind of messages with XMLNS parser because InputRoot.XML.*[<] doesnot points to the root tag of the message (I don't know why) and it is difficult to find the root tag in the message tree. The debugger shows a correct message tree, but Trace node shows that after xml decl tag there is a \n element and last child of XMLNS is bunch of spaces.
We tried to use XMLNSC parser which handles this situations nicely, but has other issue. When we recevice a message with an empty attribure i.e. <myTag/> it is parsed to message tree without a type.(all others receives CHARACTER type). Because of this element which has no type defined, MRM parser cannot write the message at the end of the flow. XMLNS assigns type even to the empty element.
The only thing we came up with so far is to parse the message as BLOB at the MQInput node, remove trailing whitespaces and \n, then ResetContentDescriptor to XMLNS. But it still doesnot solve the \n between tags problem.
I'd like to use XMLNSC parser for this, so maybe someone has an idea how to make XMLNSC assign types to empty elements.
Any other solution to above problems will be nice.
Thanks,
Alex  _________________ AV |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 01, 2007 7:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, if you're looking at InputRoot.XML, then you're not looking at InputRoot.XMLNS, and so you're not using the XMLNS parser...
But maybe that was a typo?
Otherwise, you probably can look at the Null handling properties in your message set - maybe you can adjust these to deal with what the XMLNSC parser is producing... (which is probably an null of some kind). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
verdyan |
Posted: Tue May 01, 2007 7:45 am Post subject: Typo |
|
|
Novice
Joined: 24 May 2005 Posts: 13
|
It's a typo. I meant InputRoot.XMLNS.*[<].
Thanks, I'll try what you suggested. _________________ AV |
|
Back to top |
|
 |
kimbert |
Posted: Wed May 02, 2007 1:52 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Now we have a problem handling this kind of messages with XMLNS parser because InputRoot.XML.*[<] doesnot points to the root tag of the message (I don't know why) and it is difficult to find the root tag in the message tree |
It shouldn't be difficult to find the root node in the message tree. But maybe you would still get other problems with whitespace occurring in other places in the document...which suggests that XMLNSC is a good idea....
Quote: |
We tried to use XMLNSC parser which handles this situations nicely, but has other issue. When we recevice a message with an empty attribure i.e. <myTag/> it is parsed to message tree without a type.(all others receives CHARACTER type). |
I don't understand what you mean. Are you referring to XMLNSC.PCData or some similar constant? I think an example or two would help.
Quote: |
Because of this element which has no type defined, MRM parser cannot write the message at the end of the flow. |
Why not? Please can you quote the error message which you received ( if any ).
Quote: |
The only thing we came up with so far is to parse the message as BLOB at the MQInput node, remove trailing whitespaces and \n, then ResetContentDescriptor to XMLNS. But it still doesnot solve the \n between tags problem. |
Yuk! Sounds unreliable and slow. Let's find a better way.
By the way, <myTag/> is a empty element, not an empty attribute  |
|
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
|
|
|
|