Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
Programmatic Worksheet Access
This worksheet demonstrates some of the features of the Worksheet package. This package provides support for accessing Maple worksheets programmatically. As you read this worksheet, execute the commands in sequence.
restart:
Accessing the Worksheet Package
To use the Worksheet package, you must first issue the following call to the procedure with, which provides interactive access to procedures organized in packages.
with(Worksheet);
Importing a Worksheet As an XML Document
Maple worksheets are represented in Maple as XML documents. This makes it unnecessary to know the (undocumented) storage format for the Maple worksheet and allows you to use new and existing tools for manipulating XML document instances. (For details, see XMLTools.) To create an XML representation of a worksheet, use the ReadFile and FromString commands.
wname := cat(kernelopts(datadir), "/../examplesclassic/WorksheetPackage.mws"):
doc := ReadFile(wname):
Converting a Worksheet to Different Formats
Note that Maple worksheets can be imported into Maple in two different formats: -- "mw", this is the same format that is used by the Standard worksheet,
-- "maple8_xml", the format introduced in Maple 8.
Option `format` can be used to specify which XML representation to generate.
doc2 := ReadFile(wname, format = "maple8_xml"):
Display the worksheet you loaded by using the Display command.
# Display(doc);
# Display(doc2);
Use the Convert utility to convert worksheets in "mw" format to worksheets in "maple8_xml" format and back.
doc3 := Convert(doc, format="maple8_xml"):
evalb(doc2 = doc3);
l := XMLTools:-Compare(doc2, doc3);
if l <> [] then [op(l[1..-3], doc2), op(l[1..-3], doc3)] end if;
To convert a worksheet to ".mws" format, use the ToString command.
str := ToString(doc, format = "mws"):
Accessing a Worksheet By Using the XMLTools Package
Now that you have the worksheet exported as an XML document, you can use functions from the XMLTools package to access its subnodes.
XMLTools[FirstChild](doc);
XMLTools[SecondChild](doc);
XMLTools[AttributeTable](%);
XMLTools[ThirdChild](doc);
XMLTools[ElementStatistics](doc);
XMLTools[ContentModelCount](doc);
Return to Index for Example Worksheets
Download Help Document