Hi
   You can use xpath to extract ciRequestXML. That should automatically have 
proper xml which can be parsed again.


Thanks and Regards,
Hemang Ajmera 


-----Original Message-----
From: Wilken Marci J <marci.j.wil...@dhsoha.state.or.us.INVALID> 
Sent: 03 December 2021 00:55
To: users@camel.apache.org
Subject: Converting ;&lt ;&gt to <> in camel


EXTERNAL SENDER:   Do not click any links or open any attachments unless you 
trust the sender and know the content is safe.
EXPÉDITEUR EXTERNE:    Ne cliquez sur aucun lien et n’ouvrez aucune pièce 
jointe à moins qu’ils ne proviennent d’un expéditeur fiable, ou que vous ayez 
l'assurance que le contenu provient d'une source sûre.

Is there a transform or type converter that will convert escaped xml to 
standard xml I get this from a legacy axis 1.4 system
    <inv:invokeCI>
         <!--Optional:-->
         <opCode>R</opCode>
         <!--Optional:-->
         <serviceFunction>SelectClientPerpetratorInfo</serviceFunction>
         <!--Optional:-->
         <ciRequestXML>
                    &lt;ParameterBeans&gt;
               &lt;ParameterBean&gt;
                  &lt;parameterName&gt;personNo&lt;/parameterName&gt;
                  &lt;dataType&gt;String&lt;/dataType&gt;
                  &lt;scale&gt;0&lt;/scale&gt;
                  &lt;value&gt;WL8AA7Q&lt;/value&gt;
               &lt;/ParameterBean&gt;
            &lt;/ParameterBeans&gt;
         </ciRequestXML>
         <!--Optional:-->
         <idWRKRPersn>13887</idWRKRPersn>
      </inv:invokeCI>


I need to convert the ciRequestXML from 
         &lt;ParameterBeans&gt;
               &lt;ParameterBean&gt;
                  &lt;parameterName&gt;personNo&lt;/parameterName&gt;
                  &lt;dataType&gt;String&lt;/dataType&gt;
                  &lt;scale&gt;0&lt;/scale&gt;
                  &lt;value&gt;WL8AA7Q&lt;/value&gt;
               &lt;/ParameterBean&gt;
            &lt;/ParameterBeans&gt;
to
         <ParameterBeans>
               <ParameterBean>
                 <parameterName>personNo</parameterName>
                  <dataType>String</dataType>
                  <scale>0</scale>
                  <value>WL8AA7Q</value>
               </ParameterBean>
            </ParameterBeans>
So that I can parse the xml  (am using Jackson)  into a  POJO

Without doing this
.process(new Processor() {
                @SuppressWarnings("unchecked")
                public void process(Exchange exchange) throws Exception {
                        
//log.info(exchange.getIn().getHeader("RequestBeginDate").getClass().getName());
                        List<Object> params = (List<Object>) 
exchange.getIn().getBody();
                        String inboundRequest = ((String)params.get(2)).trim()
                                                                        
.replaceAll("&amp;lt;","<")   // fix anything that has been escaped
                                                                        
.replaceAll("&amp;gt;",">")
                                                                        
.replaceAll("&lt;","<")   // fix anything that has been escaped
                                                                        
.replaceAll("&gt;",">")
                                                                        ;
                        log.info("Inbound Request: " + inboundRequest);
                        exchange.getMessage().setBody(inboundRequest);  
                
                        
                        
                }})



Regards-
Marci Wilken
She/Her/Hers
Operations Architect
Office of Information Services
OHA/DHS/CAF-CW/OR-KIDS
Desk: 503.378.2405 Cell: 503.979.9680

CONFIDENTIALITY NOTICE
This email may contain information that is privileged, confidential, or 
otherwise exempt from disclosure under applicable law. If you are not the 
addressee or it appears from the context or otherwise that you have received 
this email in error, please advise me immediately by reply email, keep the 
contents confidential, and immediately delete the message and any attachments 
from your system. 


Reply via email to