CleanEntities - Maple Help

XMLTools

 CleanEntities
 remove _XML_Entity in favor of encoded text

 Calling Sequence CleanEntities(xmlTree)

Parameters

 xmlTree - Maple XML tree; XML element

Description

 • The CleanEntities(expr) command returns an equivalent xmlTree with the _XML_Entity elements removed and replaced with encoded text.  If no entity conversion is found, the _XML_Entity will still be replaced, but with an unconverted string.

Examples

 > $\mathrm{with}\left(\mathrm{XMLTools}\right):$
 > $\mathrm{xml}≔\mathrm{ParseString}\left("Capital \Pi is different than \pi "\right)$
 ${\mathrm{xml}}{≔}{\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"tag"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"Capital"}\right){,}{\mathrm{_XML_Entity}}{}\left({"Pi"}\right){,}{\mathrm{_XML_Text}}{}\left({"is different than"}\right){,}{\mathrm{_XML_Entity}}{}\left({"pi"}\right)\right]\right)\right)$ (1)
 > $\mathrm{CleanEntities}\left(\mathrm{xml}\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"tag"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"Capital \Pi is different than \pi "}\right)\right]\right)\right)$ (2)
 > $\mathrm{xml}≔\mathrm{ParseString}\left("The number 쾀 is approximately 3.14"\right)$
 ${\mathrm{xml}}{≔}{\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"tag"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"The number"}\right){,}{\mathrm{_XML_Entity}}{}\left({"#xcf80"}\right){,}{\mathrm{_XML_Text}}{}\left({"is approximately 3.14"}\right)\right]\right)\right)$ (3)
 > $\mathrm{CleanEntities}\left(\mathrm{xml}\right)$
 ${\mathrm{_XML_Document}}{}\left({\mathrm{_XML_Element}}{}\left({\mathrm{_XML_ElementType}}{}\left({"tag"}\right){,}\left[\right]{,}\left[{\mathrm{_XML_Text}}{}\left({"The number \pi is approximately 3.14"}\right)\right]\right)\right)$ (4)

Compatibility

 • The XMLTools[CleanEntities] command was introduced in Maple 2018.