cancel
Showing results for 
Search instead for 
Did you mean: 

Top node of XML message needs value assign to it - how to do it ?

Former Member
0 Kudos

Hi,

I have an issue where the top node of my XML message needs to have a value assigned.

i.e.

<REPORT>xxxxxxxx

<ID>xxxxx</ID>

<CUST>xxxxx</CUST>

</REPORT>

Is this possible using standard graphical mapping or will I need to resort to XSLT mapping to achieve this ?

Cheers

Colin.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

The top node can have values if you map it with some value or source field. But for that the Target XSD (ext defn) schema need to cater to that requirement, something like,

<xs:element name="REPORT">

<xs:annotation>

</xs:annotation>

<xs:complexType>

<xs:simpleContent>

<xs:element name="ID" type="*******" />

</xs:extension>

</xs:simpleContent>

</xs:complexType>

</xs:element>

Please study if the xml schema definition allows this.........then hopefully it is possible to map the top node.

Regards,

Suddha

turmoll
Active Contributor
0 Kudos

Hi,

At the beginning I thought that this is not well-formed XML message, did a test in XMLSpy and it looks like it a well-formed XML message.

> <REPORT>xxxxxxxx

> <ID>xxxxx</ID>

> <CUST>xxxxx</CUST>

> </REPORT>

I created XSD that describe this message, imported into IR, did some basic (one-to-one) message mapping (output and input structures are the same).

Output message:

<?xml version="1.0" encoding="UTF-8"?>
<REPORT>
   dfasdf
   <ID>12</ID>
   <CUST>dfff</CUST>
</REPORT>

After mapping I got:

<?xml version="1.0" encoding="UTF-8"?>
<REPORT>
   <ID>12</ID>
   <CUST>dfff</CUST>
</REPORT>

Looks like you should rather forget the graphical mapping

Jakub

rodrigoalejandro_pertierr
Active Contributor
0 Kudos

hi,

i agree with Aamir.

in Data Type add an attribute for the node.

Thanks

Rodrigo

Former Member
0 Kudos

Hey

Did you try defining an attribute for <REPORT> node?

If not,please give it a try and let us know

Thanx

Aamir

Former Member
0 Kudos

Hi,

An attribute will not work.

Attributes are used to assign values inside the XML tag.

Something I did not mention - we are working with external messages so importing the XSD.

Cheers

Colin.

Former Member
0 Kudos

>>Attributes are used to assign values inside the XML tag.

Yeah,i agree with that

but as far as i know,in XML standard everything must be within Tags,if there is something outside the tag,won't it throw an error?

Thanx

Aamir

Former Member
0 Kudos

By this I meant the start XML tag

ie. <REPORT ID="1234"></REPORT>

Cheers

Colin.

Former Member
0 Kudos

Hey Colin

>> <REPORT ID="1234"></REPORT>

This is an attribute,isn't it?

Thanx

Aamir

Former Member
0 Kudos

Hi Colin,

ID is attribute Only.

If u hv XSD then export that XSD........ add attribute for Report Node........ n Import it Again.

Thanks,

Mahi