Escape Content only between XML Tags

Hello Forum-Member,

we are getting some XML-String via FTP-Polling, unfortunately the source sytsem doesnt escaping the special character like [<, >, ', ", &].

Here is the XML-String:

<?xml version="1.0" encoding="utf-8"?> 20120221 Ms Ms This is an Example & Escape "CHAR"

We needto escape only the Content between the XML-Tags. For example (see Attachment)

I am using the build-in-service of SAG → HTML encode. But the whole String will be encoded. (see Attachment)

Is there any solution for that?

Best Regards
2014-02-21 15_50_12-_new  3 - Notepad++.png

Which service you used the HTML encoding?

If not you may have to manually use string:replace service to remove those & to & from the XML data.

HTH,
RMG

This Service “pub.string:HTMLEncode”, which I am using. But the whole XML-String is going to escaped.

If I am using the Srevice “string:replace” then I thinnk I will get the same result. Meaning: The String with > < will be escaped too.

You may consider the option of fixing it in the originating system, where the garbage are produced.

if not, xml or encoding utilities will not work.
I guess you have to write some java code to scan through the document to only encode the content, not the xml tags.
It will be painful. keep in mind to deal with attributes and namespaces.

No replace only what you wanted and aware of…spl chars like &," etc…

Again its better they come correctly from the source systems other wise its a pain to deal all those spl chars in the XML parsing.

HTH,
RMG

No way.

For your XML example:

<?xml version="1.0" encoding="utf-8"?> 20120221 Ms Ms This is an Example & Escape "CHAR"

You expect to escape the ’ " ’ inside HeaderText, but how the program can know the ‘<’ of HeaderText is not an escape char inside QuoteProperties, you can’t define which to escape and which not, so program don’t know what to do.