ToSymbolicXML
ToSymbolicXML[expr]
converts an expression expr to an appropriate XML format and returns the result as SymbolicXML.
Details and Options
Examples
Basic Examples
See Also
Tech Notes
Related Guides
XML`
XML`
ToSymbolicXML
ToSymbolicXML[expr]
converts an expression expr to an appropriate XML format and returns the result as SymbolicXML.
Details and Options
- To use ToSymbolicXML, you first need to load the XML Package using Needs["XML`"].
- ToSymbolicXML is the inverse of FromSymbolicXML.
- Use ToSymbolicXML to generate SymbolicXML with no output to a file. Once the SymbolicXML is generated, you can write it to a file with Export.
- The following option can be given:
-
"ExpandRawXML" Automatic whether to convert RawXML string fragments
Examples
Basic Examples (3)
Needs["XML`"]The expression x2 returned in the corresponding SymbolicXML:
ToSymbolicXML[x ^ 2]Needs["XML`"]A notebook expression results in SymbolicXML representing ExpressionML:
ToSymbolicXML[Notebook[{Cell["Here is a notebook example"]}]]Needs["XML`"]"ExpandRawXML" can control the conversion of raw XML string segments enclosed within the RawXML wrapper:
comboFragment = XMLElement["p", {}, {"There's", RawXML["<i>trouble</i>"], "my friend, right here in River City."}];ToSymbolicXML[comboFragment, "ExpandRawXML" -> False]ToSymbolicXML[comboFragment, "ExpandRawXML" -> True](The default setting for the option, Automatic, is equivalent to True.)
This provides an alternative to ImportString for converting a segment of text XML to SymbolicXML:
ToSymbolicXML[RawXML["<p>But what is it <i>good</i> for?</p>"]]