From String - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Worksheet

  

FromString

  

parse a Maple string containing MWS data and convert it to Maple XML tree

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

FromString(str, format=output_format)

Parameters

str

-

string; mws or xml string representing Maple worksheet

format=output_format

-

(optional) equation; output_format can be either "maple8_xml" or "mw" (default)

Description

• 

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.

Examples

The following examples demonstrate how a string can be parsed and converted to a Maple XML tree.

withWorksheet:

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 }

(1)

The string str is parsed and converted to an XML tree data structure doc by using the FromString command.

doc1FromStringstr,format=maple8_xml:

doc3FromStringstr,format=mw:

The ToString command converts the XML tree data structure doc and returns it as a Maple string str1.

str1ToStringdoc1,format=mws:

str2ToStringdoc1,format=maple8_xml:

str3ToStringdoc1,format=mw:

The string str1 is once again parsed and converted to an XML tree data structure by using the FromString command.

doc3FromStringstr1,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].

Displaystr1:

Displaydoc1:

See Also

Worksheet

Worksheet[ToString]