[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: octave xml support
From: |
promach |
Subject: |
Re: octave xml support |
Date: |
Fri, 12 Apr 2019 11:30:40 -0500 (CDT) |
the following code has a runtime error at line 20 which is about fid
It seems to me that "fid = fopen( filename, 'w' );" is not successful since
this returns -1
Installing io package also does not help to eliminate this error.
Any advice ?
function struct_2_xml(filename, xml_struct, rootName);
if ~isOctave()
docNode = com.mathworks.xml.XMLUtils.createDocument(rootName);
docElem = docNode.getDocumentElement;
docElem = struct_2_xmlNode(docNode, docElem, xml_struct);
% Save the sample XML document.
xmlFileName = [filename];
xmlwrite(xmlFileName,docNode);
else
% % for octave you need the octave_xmltoolbox (C) 2007 Thomas Geiger
% % http://wiki.octave.org/wiki.pl?XMLToolboxPort
% xml_struct = octave_struct2xml( xml_struct, rootName );
% xml_save( filename, xml_struct, 'any' );
% xml_toolbox is buggy (sequence of elements is not preserved)
fid = fopen( filename, 'w' );
fprintf( fid, '<?xml version="1.0" encoding="UTF-8" standalone="yes"
?>\n'
);
fprintf( fid, octave_struct2xml_2(xml_struct,rootName,'') );
fclose( fid );
end
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html