XML with Reserved Characters - Take 2

Melodi Roberts
Melodi Roberts used Ask the Experts™
on
This is actually a continuation of this question:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_27234034.html

I’d thought I’d solved the problem using extractvalue instead of extract; however, though the results display correctly on the web, an error is thrown with Oracle forms because it still isn’t formatted properly. (e.g.  M&I MARSHALL & ILSLEY BANK)

 I am guessing that the way the web is coded strips out the reserved characters.  

Below is a portion of the XML response that I am attempting to extract the bankName from.

It seems to me that there are too many ‘amp’ strings in this.

If I run extractvalue a twice against the returned XML it works fine.

Is the problem with the XML that the third party is sending me OR is there a chance that I am maybe retrieving the raw XML incorrectly?

  <achValidateRoutingReturn xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xsi:type="ns2:string" xmlns:ns2="http://www.w3.org/2001/XMLSchema">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;Touchnet&gt;
  &lt;WsResponse InvokedMethod=&quot;achValidateRouting&quot;&gt;
    &lt;Valid&gt;YES&lt;/Valid&gt;
    &lt;BankName&gt;M&amp;amp;amp;I MARSHALL &amp;amp;amp; ILSLEY BANK&lt;/BankName&gt;
    &lt;BankAddr1&gt;4701 W SCHROEDOR DR&lt;/BankAddr1&gt;
    &lt;BankAddr2&gt;MILWAUKEE,WI 53223&lt;/BankAddr2&gt;
  &lt;/WsResponse&gt;
&lt;/Touchnet&gt;
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
The XML you posted looks fine to me.

The problem you describe sounds like double encoding.

So "MARSHALL &amp; ILSLEY" gets encoded twice and becomes "MARSHALL &amp;amp; ILSLEY "

It could be how you are retrieving the XML.  Check the raw data in the table.  If it is not double encoded then something is doing it after it is retrieved from the database.
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
>>The XML you posted looks fine to me.

Forget I said that.  I see it now.

Looks like the string is actually tripple encoded.  You need to figure out what is causing that.

I'm afraid our ability to help you troubleshoot this will be limited unless you can post code/examples (before and after)/etc... to help us, help you, figure it out.
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
I'm going to quit posting now...after this

Looks like you have encoded an entire XML "string" and somehow didn't treat it as an actual XML fragment/doc.

Look at the raw input from the third party app.  If it looks like "...  <Touchnet>   ..." then it is how you are storing it or retrieving it.

Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Melodi RobertsProgrammer/Analyst

Author

Commented:
ok.  Thanks. I will post the code that I am using to retrieve the XML from the third party shortly.  
I keep thinking that it is the third party that is doing the encoding, but it sounds like you're saying that somewhere in my code in retrieving the XML from the third party I may be encoding it again.
Melodi RobertsProgrammer/Analyst

Author

Commented:
Attached is the sample code.
I will start digging to understand where the encoding is occurring.
Thanks for your help.
validate-routing.txt
wgik-soap-ws.txt
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Unfortunately I don't have to time to walk through all that code to see where it is happening.

You'll just need to roll up the sleeves and start digging.
Melodi RobertsProgrammer/Analyst

Author

Commented:
yup. No problem. Already digging. From your help I know what I need to learn more about and where to look in the code. Thanks  a ton.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial