Square brackets in XML?
-
09-09-2019 - |
Question
In an XML document, how do I treat square brackets (] or [) ?
Solution
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>
OTHER TIPS
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>
">" does not require to be escaped.
"]" does not require to be escaped.
"]]>" require to be escaped as part of the CDATA element.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow