cancel
Showing results for 
Search instead for 
Did you mean: 

Parent Node Value

silentbull
Participant
0 Kudos

Hi,

I have a requirement from third party where they are sending the following values

<ORDER>      = 01234

     Type         = Attribute

     <Order Line> = 001

</ORDER>

These are my clarifications.

1. Can we assign value to a parent node when we have subelements. I am getting a sample xml file like this.

2. PI mapping shows the order number 01234 when you don't have any orderline i.e no subelements.

3. It does not show the value in display queue when it has subelement orderline.

But it works fine in XSLT.

Is this a bug in graphical mapping or is it a rule that no body assigns values in parent node.

Please clarify.

Regards

Sam

Accepted Solutions (1)

Accepted Solutions (1)

anupam_ghosh2
Active Contributor
0 Kudos

Hi Sam,

Here are answers to your questions

1. Can we assign value to a parent node when we have subelements. I am getting a sample xml file like this.

ans) yes this does not make the XML invalid. Any XML node can have

  • other elements
  • text
  • attributes
  • or a mix of all of the above...

2. PI mapping shows the order number 01234 when you don't have any orderline i.e no subelements.

comment) This is correct since the parent element has only a text as its child instead of sub element.

Hence PI mapping is showing the value.

3. It does not show the value in display queue when it has subelement orderline.

comment) whose display q are you trying to see? If you are trying to see the display q of node <ORDER> when <Order Line> is present then it will not show the text element of the node <ORDER> as display queue is treating the <ORDER> as parent of <Order Line> hence it becomes a complextype. Display q shows text child of the node only when it has no other child of type element. You can try deleting the <Order Line> from <ORDER> node and only keep the text "0123" then you will be able to see the contents in display q.

4.

But it works fine in XSLT.Is this a bug in graphical mapping or is it a rule that no body assigns values in parent node.

ans) I guess the XSLT code is only dealing with nodes of type ELEMENT and their text child.

The code may be only searching for element node <Order Line> thus it is not considering other TEXT child of the node <ORDER>.

The XSLT code might be also considering text child along with element node. Need to see the code before more comments can be made.

There is no bug in graphical mapping since in graphical mapping you are mapping child node of <ORDER> of type ELEMENT which is <Order Line> hence you are getting appropriate results.   I would suggest you to use mapwithdefault with <Order Line> node so that always target has a value even in absence of the node <Order Line> in the source XML.  Generally parent nodes  are expected not to carry TEXT elements in graphical mapping but as I said earlier presence of a TEXT child does not invalidate the XML. In graphical mapping you can map text element to the target only if the node does not have another child of type ELEMENT. You can also map a node having a child node of type ELEMENT but then the mapping to target can only alter the number of times target field occurs (and not the text value).

Hope this resolves your query.

Regards

Anupam

Answers (0)