StackOverflowMATLABchat / mlapp2classdef

Convert MATLAB App's XML file to *.m class definition
4 stars 5 forks source link

XML Parsing Assumes Static Location & Name #3

Open sco1 opened 8 years ago

sco1 commented 8 years ago

The current fopen call for parsing the XML file assumes a consistent name & location:

~\matlab\document.xml

Though this is consistent across tested *.mlapp examples this is not a robust approach and also does not account for the potential for multiple XML files in the published app.

sco1 commented 8 years ago

The [Content_Types].xml file located in the root of the *.mlapp contains a reference to the MATLAB code published with the app:

<Default ContentType="application/vnd.mathworks.matlab.code.document+xml;plaincode=true" Extension="xml"/>

This can be parsed to robustly obtain the filename(s) of the MATLAB code utilized by the app, which can be fed into a searching function to obtain the filepath(s).

sco1 commented 8 years ago

Mitigated for MATLAB versions newer than R2014b, see #8 and f986a72, which eliminates the intermediate *.zip unpacking step.