Jump to content

Recommended Posts

Posted

Hello,

I've got a string which I've read from an XML file. I'm extracting a bit of text from an element:

<author>Bob &amp; John</author>

Since I'm looking for the author tag, then doing a StringMid, I get the following: "Bob &amp; John"

However, I'd like to get:

Bob & John

Is there a function I can call to remove XML escape characters?

Thankyou,

Fidel

Posted

$xml = StringReplace($xml, '&amp;', '')
thanks for the quick reply, I will use this if there's not a more generic function to deal with all the other possibilities...
Posted

thanks for the quick reply, I will use this if there's not a more generic function to deal with all the other possibilities...

There is no general function to translate XML (or HTML) escaped character sequences. It would be easy to write for you specific needs though. What exactly do you mean by "all the other possibilities"? Do you want to write a single function to also find and replace '&gt;', '&lt;', '&apos;', etc.?

P.S. In Zedna's example, the replacement character was missing:

$xml = StringReplace($xml, '&amp;', '&')

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...