Validate an XML file with a given XSD file
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
Are there any tools in Matlab that will check that an xml file coforms to a given xml schema (.xsd) file?
Thanks!
0 Kommentare
Antworten (2)
Wil Koenen
am 6 Feb. 2020
You can call Java libraries from MATLAB.
schemaFileName = "MySchema.xsd";
xmlFileName = "MyXML.xml";
schemaFile = java.io.File(schemaFileName);
xmlFile = java.io.File(xmlFileName);
schemaFactory = javax.xml.validation.SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
schema = schemaFactory.newSchema(schemaFile);
validator = schema.newValidator();
fileInputStream = java.io.FileInputStream(xmlFile);
streamSource = javax.xml.transform.stream.StreamSource(fileInputStream);
validator.validate(streamSource); % throws an exception if not valid
0 Kommentare
Hari Krishna Ravuri
am 5 Nov. 2019
As of now, there is no in-built function in MATLAB to validate the given XML file with the XSD given by the user.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Structures finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!