Author |
Message
|
chenna.hari |
Posted: Mon Dec 27, 2010 1:43 am Post subject: Reading text file using MRM domain |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
Hi,
I have a text file in below format
Quote: |
A:value1, B:value2, C:value3, D:value4
1.E:value5
2.F:value6
3.G:value7
4.H:value8
|
and i need to read this file in Message broker and transform to below xml format
Quote: |
<output>
<A>value1</A>
<B>value2</B>
<C>value3</C>
<D>value4</D>
<E>value5</E>
<F>value6</F>
<G>value7</G>
<H>value8</H>
</output>
|
do you have any suggestions how to transform, please let me know |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Dec 27, 2010 2:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You create a message model that matches the input file.
You then write ESQL to create the output XML document.
Welcome to Broker, please get training and do your own learning. |
|
Back to top |
|
 |
chenna.hari |
Posted: Mon Dec 27, 2010 3:52 am Post subject: |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
ok. but i would like to get suggestion on how to create the message model using MRM.
how to model this?? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 27, 2010 5:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Your message is a classic 'Tagged Delimited' format. The delimiter is comma, and the tags are 'A', 'B', 'C'. You need to
- create a new message set
- add a TDS physical format
- create a message definition file with this structure:
Code: |
element name="messageRoot"
complexType DataElementSeparation="Tagged Delimited" Delimiter="," TagLength="2"
element name="A" Tag="A:"
element name="B" Tag="B:"
element name="C" Tag="C:"
element name="D" Tag="D:"
...
|
Your ESQL is trivial. Just copy the MRM message tree to OutputRoot.XMLNSC. Like this:
Code: |
SET OutputRoot.XMLNSC.output = InputRoot.MRM; |
|
|
Back to top |
|
 |
optimist |
Posted: Mon Dec 27, 2010 3:22 pm Post subject: |
|
|
Apprentice
Joined: 18 Nov 2010 Posts: 33
|
Is it exactly this mixed format?
A:value1, B:value2, C:value3, D:value4
1.E:value5
2.F:value6
3.G:value7
4.H:value8
OR, just:
A:value1, B:value2, C:value3, D:value4, E:value5, F:value6, G:value7, H:value8
I am not sure I understand your requirement in full. More (exact) details on the input format will help. |
|
Back to top |
|
 |
chenna.hari |
Posted: Mon Dec 27, 2010 9:03 pm Post subject: |
|
|
Centurion
Joined: 21 Mar 2009 Posts: 103
|
It is Exactly mixed format which i mentioned
Quote: |
A:value1, B:value2, C:value3, D:value4
1.E:value5
2.F:value6
3.G:value7
4.H:value8
|
note: length of tags A, B, C, D,.... will not be equal |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Dec 28, 2010 2:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
TDS can still handle this.
You just need to adjust the model given to match the tags in use.
The model you were given will actually handle this as well. You just might not like how element D ends, for example. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Dec 28, 2010 4:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
note: length of tags A, B, C, D,.... will not be equal |
You need to
- change the tags to "A", "B" etc ( so remove the colon )
- set the Tag Data Separator to colon ( |
|
Back to top |
|
 |
|