Error using matlab.io.xml.transform or matlab.io.xml.dom packages
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I'm dealing with xml string and trying transform API from this page:
https://www.mathworks.com/help/matlab/xml-documents.html?s_tid=CRUX_lftnav
import matlab.io.xml.transform.*
sourceObj = SourceFile("capitals.xml");
transform(Transformer,sourceObj,"capitals.xsl","capitals.html");
and got this error
Error using matlab.io.xml.transform.Transformer/transform
Transform error: file "capitals.xml" does not exist.
I download the example in my folder "~\Documents\MATLAB\Examples\R2022a\matlab" by using this code:
openExample('matlab/TransformXMLIntoHTMLExample')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1432358/image.png)
and I confrimed the file is in my path, but R2022a still give me same error.
I also tried using matlab.io.xml.dom. and also got file doesn't exist error.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1432373/image.png)
Here are my ver and Toolbox. Did I miss something?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1432363/image.png)
0 Kommentare
Antworten (1)
Sai Teja G
am 10 Aug. 2023
Hi Wu,
I see that you are using relative path in your code and “capitals.xml” is in a different folder. This may be the reason for the error.
You can resolve the issue by using absolute paths instead of relative paths, in both “matlab.io.xml.transform” and “matlab.io.xml.dom”.
Hope this helps!
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!