Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angle bracket in xml value

Tags:

xml

How can I put an angle bracket ("<") in my xml attribute?

I'm trying to store an SQL query, but this seems to be illegal.

<add key="query" value="SELECT DISTINCT index FROM table WHERE langCode <> 'FR'"/> 
like image 873
Andrew Avatar asked Aug 25 '11 21:08

Andrew


People also ask

Can you have brackets in XML?

Note: The square brackets ( [ ] ) in the Edit Element dialog box represent XML opening and closing tags. To type a square bracket in the text of your design, use the following codes: &left; for “[“ or &right; for “]”. Select the XML element for which you want to edit the text content in the XML Tree.

How do you escape an angle bracket in XML?

The escape character for XML is the ampersand, &. The other dangerous character is the left angle bracket, the “less than,” <. Mostly to be symmetric, we also handle the right angle bracket, the “greater than,” >, similarly.

What do angle brackets mean in coding?

What Does Angle Bracket Mean? The angle bracket (< or >), which is also called an “inequality sign” for its use in mathematics, is a kind of sideways caret that can be used to include tags or pieces of code. This ASCII set of characters is common in web design and other types of coding projects.

Are square brackets allowed in XML?

Square brackets do not need a specific notation in XML but they have a special meaning when used in XPath expressions for XSL transformations.


1 Answers

Use &lt; and &gt; instead of < and >:

<add key="query" value="SELECT DISTINCT index FROM table WHERE langCode &lt;&gt; 'FR'"/> 
like image 152
Adam Batkin Avatar answered Oct 12 '22 01:10

Adam Batkin