Question:

Xml help, using < in a string?

by  |  earlier

0 LIKES UnLike

well im using xml and this is the code:

<icon content=" some text including < more text" >

this returns an error, how can i use the < and > within a string?

 Tags:

   Report

3 ANSWERS


  1. Use character entities instead. These consist of an &quot;&amp;&quot; sign, followed by a short descriptor, followed by a semicolon. The ones you&#039;re looking for are &amp; lt; for the &lt; sign, and &amp; gt; for the &gt; sign. Remove the spaces between the &amp; and the letters; I had to insert them to prevent Y!A from turning them into the symbols themselves.

    The complete list is at the link below.


  2. use the cdata tag.

    &lt;icon content=&lt;![CDATA[ &quot;some text including &lt; more text&quot;]]&gt;&gt;


  3. If you want to use the &lt; character inside XML text/strings, use:

    &amp; lt;

    Similarly use &amp; gt; for &gt;, &amp; quot; for &quot; (double quotes) and so on.

    I suggest you find yourself an xml character entity chart. Google for it.

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.