Author |
Message
|
sridhsri |
Posted: Fri Aug 08, 2008 11:30 am Post subject: Generating XML Encoded messages |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
This is a subject that has been discussed before. But I didn't find a definitive answer.
I have a MRM-TDS (CVS) message coming in. I also have a XSD which this TDS will get mapped to. I use a mapping node to generate the XML. I found two problems
1) The incoming CVS has string with '&'. These get copied as-is to XML i.e., they are not encoded to &. After the mapping node, I am using a RCD node to reset it to XMLNSC (It was XMLNSC to begin with in the mapping). I put this in to set options like (Build Tree using XML Schema Data Types). That still didn't encode the XML.
2) The XMLNSC parser is not creating the XML processing instruction (<?xml verions="1.0"?>). This gets created only if I use MRM-XML. Is there any way the XMLNSC parser can create this for me ? |
|
Back to top |
|
 |
sridhsri |
Posted: Fri Aug 08, 2008 11:36 am Post subject: |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
P.S - I'd prefer want to write ESQL code for this. |
|
Back to top |
|
 |
sridhsri |
Posted: Fri Aug 08, 2008 1:39 pm Post subject: |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
d'oh - I'd prefer NOT to write ESQL for this. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 08, 2008 2:52 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The incoming CVS has string with '&'. These get copied as-is to XML i.e., they are not encoded to &. |
The XMLNSC parser should replace & with & when it writes the output message. This is done for all text content of elements. Are you saying that the output XML contains un-translated & characters? If you still have a problem, please include an extract from the output message in your reply.
Quote: |
After the mapping node, I am using a RCD node to reset it to XMLNSC (It was XMLNSC to begin with in the mapping). I put this in to set options like (Build Tree using XML Schema Data Types). That still didn't encode the XML. |
- The XMLNSC parser options affect parsing. They are not used at all when writing
- Please read the docs and make sure that you understand what 'Build tree using XML schema' is for.
Quote: |
The XMLNSC parser is not creating the XML processing instruction (<?xml verions="1.0"?>). This gets created only if I use MRM-XML. Is there any way the XMLNSC parser can create this for me ? |
The XMLNSC parser does not use any of the information in the XML physical format. That may change in a future release ( that is not a promise, or even a hint ) but in v6.1 you need to write ESQL or else write map statements to create the XML declaration structure in the output tree. |
|
Back to top |
|
 |
sridhsri |
Posted: Sat Aug 09, 2008 10:34 am Post subject: |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
Thanks for the reply Tim. Here is a sample from the output message
<PRODUCT_GROUP docNo="19">
<CRUD>P</CRUD>
<GROUP_CODE>DT </GROUP_CODE>
<GROUP_NAME>DIAGN & THERAPY </GROUP_NAME>
<GROUP_DESCRIPTION>DIAGN & THERAPY </GROUP_DESCRIPTION>
</PRODUCT_GROUP>
Like I said before the incoming message is TDS (although each element is fixed length). We are using a mapping node to map from TDS to XML.
I must also mention that I am unable to reproduce this error with a sample message flow. Somehow it appears that with this message, the XML Encoding is not being enforced. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Aug 12, 2008 1:06 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Solved! XMLNSC was doing the right thing all along. sridhsri was using RFHUtil to view the output message. The XML viewer in RFHUtil decodes the character entity & and turns it back into &. So it looked as if XMLNSC was not encoding the &.
A very forgivable mistake. I am posting this in case somebody else gets bitten in the same way. |
|
Back to top |
|
 |
|