Worksheet
FromString
parse a Maple string containing MWS data and convert it to Maple XML tree
Calling Sequence
Parameters
Description
Examples
FromString(str, format=output_format)
str
-
string; mws or xml string representing Maple worksheet
format=output_format
(optional) equation; output_format can be either "maple8_xml" or "mw" (default)
The FromString(str) calling sequence parses the input string str, which is assumed to be a valid Maple worksheet. It then converts it to a Maple XML tree.
Errors detected by the parser in this routine are reported, but the parser does not validate the worksheet. Only errors that prevent this routine from converting the input string into an internal XML format are detected.
FromString maps automatically over its arguments, returning an expression sequence of results.
The following examples demonstrate how a string can be parsed and converted to a Maple XML tree.
with⁡Worksheet:
str≔{VERSION 5 0 \"SUN SPARC SOLARIS\" \"5.0\" }{USTYLETAB }{SECT 0 {EXCHG {PARA 0 \"\" 0 \"\" {TEXT -1 21 \"Very simple worksheet\" }}{PARA 0 \"> \" 0 \"\"{MPLTEXT 1 0 16 \"with(Worksheet);\"}}}{EXCHG {PARA 0 \"> \" 0 \"\" {MPLTEXT 1 0 0 \"\" }}}}{MARK \"1 0 0\" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }
str≔{VERSION 5 0 "SUN SPARC SOLARIS" "5.0" }{USTYLETAB }{SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 21 "Very simple worksheet" }}{PARA 0 "> " 0 ""{MPLTEXT 1 0 16 "with(Worksheet);"}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "1 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }
The string str is parsed and converted to an XML tree data structure doc by using the FromString command.
doc1≔FromString⁡str,format=maple8_xml:
doc3≔FromString⁡str,format=mw:
The ToString command converts the XML tree data structure doc and returns it as a Maple string str1.
str1≔ToString⁡doc1,format=mws:
str2≔ToString⁡doc1,format=maple8_xml:
str3≔ToString⁡doc1,format=mw:
The string str1 is once again parsed and converted to an XML tree data structure by using the FromString command.
doc3≔FromString⁡str1,format=maple8_xml:
The Display command launches the worksheets. The Display command launches the string str1 and the XML tree doc1. For information on Display command parameters, see Worksheet[Display].
Display⁡str1:
Display⁡doc1:
See Also
Worksheet[ToString]
Download Help Document