Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Square brackets in XML?

In an XML document, how do I treat square brackets (] or [) ?

like image 900
Rahul Vyas Avatar asked Apr 14 '09 06:04

Rahul Vyas


2 Answers

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

<root>
  <el attrib="[">[</el>
</root>
like image 128
Kirtan Avatar answered Sep 28 '22 18:09

Kirtan


There is probably a better solution. But this works:

&#x005D;

as in:

<blah value="&#x005D;"></blah>

then again, so does (see Kirtan's answer):

<blah value="]"></blah> 
like image 37
RedBlueThing Avatar answered Sep 28 '22 16:09

RedBlueThing