Author |
Message
|
Omuch |
Posted: Thu May 31, 2012 1:58 am Post subject: Xml attribute changed to element |
|
|
Acolyte
Joined: 23 Mar 2012 Posts: 54
|
Hi
I'm using Broker 6.1.0.7
Has anyone ever encountered a problem in mapping node that changed an XML attribute to XML element
Should be:
Code: |
<Person age="20" >
.
.
.</Person>
|
What comes:
Code: |
<Person>
<age>20</age>
.
.
.
</Person>
|
|
|
Back to top |
|
 |
kimbert |
Posted: Thu May 31, 2012 2:07 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
What domain are you using for OutputRoot? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 31, 2012 2:12 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Did you populate the data into a tree that does not have an XMLNSC parser associated with it before the mapping node?
Does the message definition that the Mapping node is using to create the output message specify that this field must be an attribute? |
|
Back to top |
|
 |
Omuch |
Posted: Thu May 31, 2012 5:13 am Post subject: |
|
|
Acolyte
Joined: 23 Mar 2012 Posts: 54
|
mqjeff wrote: |
Did you populate the data into a tree that does not have an XMLNSC parser associated with it before the mapping node? |
I'm using MRM before and after the mapping node
mqjeff wrote: |
Does the message definition that the Mapping node is using to create the output message specify that this field must be an attribute? |
Yes, and the value of the attribute is fixed.
I have repeated elements in the tree , the mapping node creates the first as attribute but the second as element.
Code: |
<Person age="20">
.
.
</Person>
.
.
<Person>
<age>20<age>
.
.
</Person>
|
|
|
Back to top |
|
 |
kimbert |
Posted: Thu May 31, 2012 5:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
My best guess : the structure of the output message tree does not match the structure of the message definition. Please set Validation to 'Content and Value' on the Mapping node. If you get a validation error from the MRM parser then I'm right. |
|
Back to top |
|
 |
Omuch |
Posted: Sat Jun 02, 2012 12:08 pm Post subject: |
|
|
Acolyte
Joined: 23 Mar 2012 Posts: 54
|
kimbert wrote: |
My best guess : the structure of the output message tree does not match the structure of the message definition.. |
Of course it doesn't match , instend of an attribute I'm getting
a new element that isn't on the message definition .
kimbert wrote: |
Please set Validation to 'Content and Value' on the Mapping node. If you get a validation error from the MRM parser then I'm right. |
Even if you're right, why it's happening ? and how I should fix it? |
|
Back to top |
|
 |
kimbert |
Posted: Sat Jun 02, 2012 12:15 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I don't think your understand what mean when I say 'structure'. I'm talking about the logical structure, not the physical rendering of that structure in an XML document.
I suggest that you try my suggestion anyway. Either you will disprove my theory, or you will confirm it. If the latter then a careful reading of the error message would probably answer your questions. |
|
Back to top |
|
 |
Omuch |
Posted: Sat Jun 02, 2012 10:37 pm Post subject: |
|
|
Acolyte
Joined: 23 Mar 2012 Posts: 54
|
kimbert wrote: |
I suggest that you try my suggestion anyway. Either you will disprove my theory, or you will confirm it. If the latter then a careful reading of the error message would probably answer your questions. |
I tried it, there is no error.
The output of the mapping node is valid, but I still have a new element instead of an attribute. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jun 03, 2012 12:58 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Omuch wrote: |
kimbert wrote: |
I suggest that you try my suggestion anyway. Either you will disprove my theory, or you will confirm it. If the latter then a careful reading of the error message would probably answer your questions. |
I tried it, there is no error.
The output of the mapping node is valid, but I still have a new element instead of an attribute. |
So have you defined it as an attribute in your message set?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Omuch |
Posted: Mon Jun 04, 2012 11:43 am Post subject: |
|
|
Acolyte
Joined: 23 Mar 2012 Posts: 54
|
fjb_saper wrote: |
Omuch wrote: |
kimbert wrote: |
I suggest that you try my suggestion anyway. Either you will disprove my theory, or you will confirm it. If the latter then a careful reading of the error message would probably answer your questions. |
I tried it, there is no error.
The output of the mapping node is valid, but I still have a new element instead of an attribute. |
So have you defined it as an attribute in your message set?  |
Yes, and the value is fixed.
I checked it and really, the structure of the output tree doen't match the structure of the message definition as kimbert sayed,
but for some reason I didn't get an validation error.
Code: |
In the message definition it looks like:
.
.
Person_1 complex type max occurs: 100
Person_2 complex type max occurs: 100
And after the mapping :
Person_1
Person_2
Person_1
Person_2
.
.
.
|
I think it's because of this Mismatch, but the fact is that the mapping is able to map the whole object in his second instance except his attribute. |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jun 04, 2012 11:45 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm quite sure it's because you're using MRM to model XML instead of XMLNSC and because you haven't taken efforts to ensure that your sequences are CLOSED rather than OPEN.
In other words, please switch to using XMLNSC. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jun 04, 2012 2:29 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I agree with mqjeff. This is an example of why XMLNSC has been provided as a replacement for MRM XML. |
|
Back to top |
|
 |
|