Author |
Message
|
matuwe |
Posted: Thu Sep 09, 2010 3:38 am Post subject: PARSE XML looses XML Root Tag |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
Hi,
I am testing a message set which was generated from XSD with structure
Code: |
<Page>
<Header>
<PageLine>
<Header/>
<Body>
<test1/>
<test2/>
</Body>
</Page>
|
After the ESQL parse and validate using MRM domain, I get the message
Code: |
<Header>
<PageLine> 1-1
<Header/>
<Body> 1-1
<test1/>
<test2/>
</Body>
|
ANd my root tag is gone. Is there something I need to change on the message set to make this work. The message definition file, under messages I have
Page
Header
Body
If I try parsing using XMLNSC then I get the root tag. I am using Broker 7.0.0.0
Code: |
Create LASTCHILD OF Environment.TEST DOMAIN ('MRM') PARSE(Environment.Data
OPTIONS BITOR (ValidateContentAndValue,ValidateException,ValidateImmediate)
SET TRIM(Environment.currentTransformation.transformation)
TYPE TRIM(Environment.currentTransformation.messageFormat)
FORMAT TRIM(Environment.currentTransformation.messageType)
ENCODING InputRoot.Properties.Encoding
CCSID InputRoot.Properties.CodedCharSetId
); |
|
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 09, 2010 4:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Why are you using a message set to parse an XML document rather than XMLNSC? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 09, 2010 4:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
my root tag is gone. Is there something I need to change on the message set to make this work. |
Nope. MRM XML discards your root tag for free, without any configuration required
In older versions, you could even discard a child of the root tag as well. That required some configuration, and was so useful that we dropped the property in v6.0.
I should probably provide a slightly more serious explanation as well. The MRM parser can also parse non-XML formats, and in these cases users don't expect to have the MessageType property as the root tag ( the concept of a root tag is very XML-specific ). So the MRM XML parser omitted the XML root tag in order to make the tree shape the same for both XML and non-XML.
Quote: |
Why are you using a message set to parse an XML document rather than XMLNSC? |
Those are not alternatives. XMLNSC can, and these days very often does, use a message set.
I think you meant to ask 'why are you using MRM XML and not XMLNSC?'. Which is a fair question. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 09, 2010 4:23 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
I think you meant to ask 'why are you using MRM XML and not XMLNSC?'. Which is a fair question. |
Yes, yes, quite. Insufficient coffee causing a problem in the brain/finger interface.
 _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
matuwe |
Posted: Thu Sep 09, 2010 4:59 am Post subject: |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
Oww I am using MRM as I needed to have one compute node to do my parsing. This is used by all my other interfaces (NONE XML) by sending the appropriate parameters. Is there any way of making this work using MRM? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 09, 2010 5:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
So you have a whole load of existing non-XML interfaces, and now you're adding a new interface that uses XML - right? I don't see the problem - if you're using XML throughout, the consistent omission of the root tag for *all* intefaces should be an advantage, not a problem.
btw, did you know that your 'set' and 'type' parameters are the wrong way round in the ESQL that you quoted. Hopefully just a typo. |
|
Back to top |
|
 |
matuwe |
Posted: Thu Sep 09, 2010 5:21 am Post subject: |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
OK I will consider changing the other interfaces to XMLNSC. I am just scared to do it as it is about 84 interfaces deployed already. Yes sorry it is just a typo when I copied the data.
Thanks  |
|
Back to top |
|
 |
kimbert |
Posted: Thu Sep 09, 2010 7:01 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I will consider changing the other interfaces to XMLNSC. |
Feel free to do that, but I didn't actually recommend it.
I still don't understand why the MRM XML tree structure is a problem to you.
Quote: |
as it is about 84 interfaces deployed already. |
I thought you said that the other interfaces were all 'NONE XML'. Presumably you meant 'not XMLNSC'.
But I'm still puzzled - if the other 84 interfaces are all using MRM XML, why is the MRM XML tree shape suddenly a problem? |
|
Back to top |
|
 |
Vitor |
Posted: Thu Sep 09, 2010 7:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
But I'm still puzzled - if the other 84 interfaces are all using MRM XML, why is the MRM XML tree shape suddenly a problem? |
If the coffee has now kicked in correctly, I believe that the OP means that the other 84 interfaces are NONE XML in the sense of fixed length records, HL7, etc rather than self describing data and a single Compute node referencing the MRM tree is to deal with them all.
I could be completely wrong in my interpretation. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
matuwe |
Posted: Thu Sep 09, 2010 11:34 pm Post subject: |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
Oww yes, thanks Victor, that is what I meant. I am using mostly fixed length messages, and now I have started deploying messages that are originally XML structure. I managed to fix the problem by changing parse option
DECLARE parseOptions INTEGER BITOR (FolderBitStream, ValidateContentAndValue,ValidateException,ValidateImmediate); and adding the FolderBitStream. The XML message doesn't loose the root tag any more.
Thanks all for helping, at least I have learned a lot more about MRM behavior from this topic.  |
|
Back to top |
|
 |
|