2

I have got a simple question, I have a xml string with an url inside, which contains the "ls="

<?xml version="1.0" encoding="utf-8"?>
   <resources>
      <string name="passOnText">iOS: https://itunes.apple.com/us/app/xyz/id123456?l=de&ls=1&mt=8 \nAndroid: http://play.google.com/store/apps/details?id=x.y.z</string>
   </resources>

now the xml validator tells me that:

The reference to entity "ls" must end with the ';' delimiter.

how can I workaroud this problem?

thanks in advance

lukas


edited title from "xml String with ls= inside" to "xml String with & inside"

2

2 Answers 2

2

& is a special character in XML that starts an entity reference. The XML parser then goes looking for the terminating ; of the entity reference and doesn't find one.

To produce & itself, write &amp; in the XML. (It's an entity reference, amp short for "ampersand".)

Sign up to request clarification or add additional context in comments.

Comments

0

If you want to give a link you should use a href in your string values.

Here is your working code:

<string name="passOnText">iOS: <a href="https://itunes.apple.com/us/app/xyz/id123456?l=de&ls=1&mt=8"> Click Here for iOS </a></string>
<string name="passOnText2">Android: <a href="http://play.google.com/store/apps/details?id=x.y.z> Click Here for Android </a></string>

3 Comments

thank you really much for this additional information! I diden't know that this is possible! thank you
In XML, & needs to be escaped in attributes as well as in elements. So this does not solve the problem.
I tried his code and correct it by this codes. This works and I said "If you want to give a link you should use a href in your string values." then share this code. I didnt claim that I solved "&" problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.