Reputation: 28730
In an XML document, how do I treat square brackets (] or [) ?
Upvotes: 8
Views: 17486
Reputation: 14865
">" does not require to be escaped.
"]" does not require to be escaped.
"]]>" require to be escaped as part of the CDATA element.
Upvotes: 1
Reputation: 42532
There is probably a better solution. But this works:
]
as in:
<blah value="]"></blah>
then again, so does (see Kirtan's answer):
<blah value="]"></blah>
Upvotes: 3
Reputation: 21695
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>
Upvotes: 16