Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of Greater Than Symbol in XML

Tags:

xml

xsd

I had created the xml document with xml version="1.0".

In that document I need to use the greater than symbol > and less than symbol <.

How should I include those symbols? It's not working.

&gt; and &lt; are not working for me.

Is there any special encoder for this?

like image 587
praveenjayapal Avatar asked Dec 01 '08 12:12

praveenjayapal


People also ask

How can we use less than and greater in XML?

You will have to use XML escape characters: " to &quot; ' to &apos; < to &lt; > to &gt; & to &amp; Google escaping characters in XML for more information.

How do I pass the greater than symbol in XML?

Just &lt; and &gt; . If you need an 'equals', simply append a = character.

Which characters are not allowed in XML?

The only illegal characters are & , < and > (as well as " or ' in attributes, depending on which character is used to delimit the attribute value: attr="must use &quot; here, ' is allowed" and attr='must use &apos; here, " is allowed' ). They're escaped using XML entities, in this case you want &amp; for & .

How do I find special characters in XML?

Open an XML document in the text editing mode, right click inside it and there is a new menu item "Determine Complex Layout Chars".


2 Answers

You need the Character Entity References

< = &lt;

> = &gt;

like image 143
Greg Avatar answered Sep 25 '22 12:09

Greg


You can try to use CDATA to put all your symbols that don't work.

An example of something that will work in XML:

<![CDATA[ function matchwo(a,b) {     if (a < b && a < 0) {         return 1;    } else {        return 0;    } } ]]> 

And of course you can use &lt; and &gt;.

like image 26
Patrick Desjardins Avatar answered Sep 24 '22 12:09

Patrick Desjardins