How can I check whether a XML file uses a XML Schema Definition (XSD)? For example, if you decompress a signed odt file (LibreOffice or OpenOffice text document), in the directory META-INF is the signaturefile documentsignatures.xml.
In this file the attribute xmlns
defines a default namespace for the elements <Signature>
and <document-signatures>
. There is neither a reference by the attribute xmlns:xsi
to the XML Schema Instance (XSI) namespace "http://www.w3.org/2001/XMLSchema-instance"
nor a reference by the attribute xsi:schemaLocation
to the XML schema file xmldsig-core-schema.xsd
. As a result, the entire content of the documentsignatures.xml file should not be validated under any scheme. Is that correct?
Here are the first lines of the correspnding XML document documentsignatures.xml:
<?xml version="1.0" encoding="UTF-8"?>
<document-signatures xmlns="urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0">
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="ID_006900630020002d0084000e004a008b009b00a6006f004b007c007b002d007f">
<SignedInfo>...
Greetings
Kaleun
"...How can I check whether a XML file uses a XML Schema Definition (XSD)?..."
(1) You cannot, if there is no embedded reference in an XML file by the attribute xsi:schemaLocation
to the XML schema.
(2) Though, whatever API is in use, it can still validate against some XSD schema that is not mentioned in the actual XML file.