DocumentationMathematicaAdd-ons & LinksXML CapabilitiesTransforming XML
Mathematica is uniquely suited for processing symbolic expressions because of its powerful pattern-matching abilities and its large collection of built-in structural manipulation functions. This section provides a few examples to illustrate the use of Mathematica for processing XML data.
When you import an arbitrary XML document into Mathematica, it is automatically converted into a SymbolicXML expression. SymbolicXML is the format used for representing XML documents in Mathematica syntax. The conversion to SymbolicXML translates the XML document into a Mathematica expression, while preserving its structure. The advantage of converting XML data into SymbolicXML is that you can directly manipulate SymbolicXML using any of Mathematica's built-in functions.
The following command converts an XML string into a SymbolicXML expression.
Here we use a simple transformation rule to remove the unwanted "red" element from the list.
You can use ExportString to convert SymbolicXML into native XML syntax, which was designed to be easy to read.