cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Mathcad Prime 9.0 Scripting with XML Data

TC_10696099
4-Participant

Mathcad Prime 9.0 Scripting with XML Data

Hello,

My company is migrating from Mathcad 15 to Mathcad Prime 9.0.

 

We have a number of Python scripting files that generate Mathcad 15 files by creating the XML data needed to generate and access Mathcad 15 files.

 

In Mathcad Prime 9.0, it looks like the files are not purely XML data. There appears to be some sort of header and footer data, in addition to the XML data.

 

Is there information on what the header and footer data is?

 

Additionally, the Python scripts internal to my company just puts together a string of characters to generate the XML data. Would this work in Mathcad Prime 9.0? I need to convert the files to support Mathcad Prime 9.0, but it doesn't appear to be as straightforward as I thought.

 

 

 

4 REPLIES 4
LucMeekes
23-Emerald III
(To:TC_10696099)

A Prime .mcdx file is essentially a .zip file. If you change the file extension to .zip you can open it with Windows explorer and inspect its contents. 

 

Success!

Luc

Hi

One way is to convert Mathcad 15 files after creation.

There is a converter program Mathcad 15 and earlier to Prime 9.0 that installs by ticking the box during installation of Prime 9.0.

It is a batch processor and can handle a large number of files at once.

The end result always needs human intervention because layout of math and text regions is often unacceptable.

 

A Prime file is a winzip file without the "*.zip" extension using ."*.mcdx" instead.  Change the file extension and you can read in winzip archive or Prime 9 respectively.  You can create/change the underlying zipped xml data. Change the extension to zip. Extracting the files from the winzip archive, Make the alterations. Zip the archive again, Change the extension to mcdx.  I have used this technique for large combo boxes.  I guess the file extension switching, unzipping of archive, zipping back, and changing extension can be scripted in python?

 

In the archive+ is a directory structure that contains all the information.  In Mathcad 15 xml is in one file with all the information..  In Prime 9.0 information is spread across a number of files in the directory.

 

Most of the files would be consistent across many documents.  Just have a look and experiment.

The main body with the regions looks very much like those sections of a 15 files xml.

 

the file called \mathcad\worksheet.xml is the regions file.  the file called \mathcad\result.xml is for inline equals results.  

the file called \docProps\app.xml and \docProp\core.xml do not need to change.  You will get the hang of it with a bit of experimentation.  There is no documentation for this.

 

Cheers

Terry

 

 

 

 

 

 

 

 

 

 

 

 

Terry,

Thank you for the information, that is very helpful.

After looking at some of the .XML files, it doesn't appear to be apples-to-apples with the formatting of Mathcad 15 XML data. As you said, the results are put into a result.xml file, the worksheet is in the worksheet.xml file, etc.

This is a good first starting point and I will try to make these work.

Terry,

 

After looking at some of the Zip files, it looks like the XML formatting of the Prime files is very different from the Mathcad 15 XML files.

In Mathcad 15, all of the XML data is in the one .xmcd (if you view a Mathcad 15 file in Notepad, for example), but in Prime, the results may be split across multiple .xml files as you suggested.

This could work, but I may just resort to using the Export to Excel feature in Prime, since this is ultimately what my Python scripts do. It's a shame that the Prime and 15 are so different in how they format their files.

Announcements

Top Tags