After using Delphi 12 “XML Data Binding” with xsd file, I tried to load the XML file, but I got “Interface not supported” error.
This is the whole xsd file content:
<code><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.easa.europa.eu/erules-export" elementFormDefault="qualified"
xmlns="http://www.easa.europa.eu/erules-export">
<!--
EASA eRules XML Export 1.0.0 - Schema Definition
June 2022
-->
<xs:import namespace="http://schemas.microsoft.com/office/2006/xmlPackage"/>
<xs:element name="document" type="document-type"/>
<xs:complexType name="document-type">
<xs:sequence>
<xs:element name="frontmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="backmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attributeGroup ref="document-metadata"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="frontback-type">
<xs:attributeGroup ref="sdt"/>
</xs:complexType>
<xs:complexType name="toc-type">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="heading" type="heading-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="topic" type="topic-type" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="topic-type">
<xs:attributeGroup ref="sdt"/>
<xs:attributeGroup ref="title"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="heading-type">
<xs:attributeGroup ref="sdt"/>
<xs:attribute name="title" type="xs:string"/>
</xs:complexType>
<xs:attributeGroup name="topic-metadata">
<xs:attribute name="ERulesId" type="xs:string"/>
<xs:attribute name="Domain" type="xs:string"/>
<xs:attribute name="ActivityType" type="xs:string"/>
<xs:attribute name="AircraftCategory" type="xs:string"/>
<xs:attribute name="AircraftUse" type="xs:string"/>
<xs:attribute name="AmendedBy" type="xs:string"/>
<xs:attribute name="ApplicabilityDate" type="xs:string"/>
<xs:attribute name="EntryIntoForceDate" type="xs:string"/>
<xs:attribute name="EquivalentForeignRegulation" type="xs:string"/>
<xs:attribute name="ICAOReference" type="xs:string"/>
<xs:attribute name="Keywords" type="xs:string"/>
<xs:attribute name="RegistryState" type="xs:string"/>
<xs:attribute name="RegulatedEntity" type="xs:string"/>
<xs:attribute name="RegulatorySource" type="xs:string"/>
<xs:attribute name="RegulatorySubject" type="xs:string"/>
<xs:attribute name="TechnicalSubjectMatter" type="xs:string"/>
<xs:attribute name="TypeOfContent" type="xs:string"/>
<xs:attribute name="ParentIR" type="xs:string"/>
<xs:attribute name="EASACategory" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="sdt">
<xs:attribute name="sdt-id" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="document-metadata">
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="pub-time" type="xs:string"/>
<xs:attribute name="map-url" type="xs:string"/>
<xs:attribute name="pub-template-url" type="xs:string"/>
<xs:attribute name="xslt-url" type="xs:string"/>
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="title">
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
</xs:schema>
</code>
<code><?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.easa.europa.eu/erules-export" elementFormDefault="qualified"
xmlns="http://www.easa.europa.eu/erules-export">
<!--
EASA eRules XML Export 1.0.0 - Schema Definition
June 2022
-->
<xs:import namespace="http://schemas.microsoft.com/office/2006/xmlPackage"/>
<xs:element name="document" type="document-type"/>
<xs:complexType name="document-type">
<xs:sequence>
<xs:element name="frontmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="backmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attributeGroup ref="document-metadata"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="frontback-type">
<xs:attributeGroup ref="sdt"/>
</xs:complexType>
<xs:complexType name="toc-type">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="heading" type="heading-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="topic" type="topic-type" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="topic-type">
<xs:attributeGroup ref="sdt"/>
<xs:attributeGroup ref="title"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="heading-type">
<xs:attributeGroup ref="sdt"/>
<xs:attribute name="title" type="xs:string"/>
</xs:complexType>
<xs:attributeGroup name="topic-metadata">
<xs:attribute name="ERulesId" type="xs:string"/>
<xs:attribute name="Domain" type="xs:string"/>
<xs:attribute name="ActivityType" type="xs:string"/>
<xs:attribute name="AircraftCategory" type="xs:string"/>
<xs:attribute name="AircraftUse" type="xs:string"/>
<xs:attribute name="AmendedBy" type="xs:string"/>
<xs:attribute name="ApplicabilityDate" type="xs:string"/>
<xs:attribute name="EntryIntoForceDate" type="xs:string"/>
<xs:attribute name="EquivalentForeignRegulation" type="xs:string"/>
<xs:attribute name="ICAOReference" type="xs:string"/>
<xs:attribute name="Keywords" type="xs:string"/>
<xs:attribute name="RegistryState" type="xs:string"/>
<xs:attribute name="RegulatedEntity" type="xs:string"/>
<xs:attribute name="RegulatorySource" type="xs:string"/>
<xs:attribute name="RegulatorySubject" type="xs:string"/>
<xs:attribute name="TechnicalSubjectMatter" type="xs:string"/>
<xs:attribute name="TypeOfContent" type="xs:string"/>
<xs:attribute name="ParentIR" type="xs:string"/>
<xs:attribute name="EASACategory" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="sdt">
<xs:attribute name="sdt-id" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="document-metadata">
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="pub-time" type="xs:string"/>
<xs:attribute name="map-url" type="xs:string"/>
<xs:attribute name="pub-template-url" type="xs:string"/>
<xs:attribute name="xslt-url" type="xs:string"/>
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="title">
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
</xs:schema>
</code>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.easa.europa.eu/erules-export" elementFormDefault="qualified"
xmlns="http://www.easa.europa.eu/erules-export">
<!--
EASA eRules XML Export 1.0.0 - Schema Definition
June 2022
-->
<xs:import namespace="http://schemas.microsoft.com/office/2006/xmlPackage"/>
<xs:element name="document" type="document-type"/>
<xs:complexType name="document-type">
<xs:sequence>
<xs:element name="frontmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="1"/>
<xs:element name="backmatter" type="frontback-type" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attributeGroup ref="document-metadata"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="frontback-type">
<xs:attributeGroup ref="sdt"/>
</xs:complexType>
<xs:complexType name="toc-type">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element name="toc" type="toc-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="heading" type="heading-type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="topic" type="topic-type" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="topic-type">
<xs:attributeGroup ref="sdt"/>
<xs:attributeGroup ref="title"/>
<xs:attributeGroup ref="topic-metadata"/>
</xs:complexType>
<xs:complexType name="heading-type">
<xs:attributeGroup ref="sdt"/>
<xs:attribute name="title" type="xs:string"/>
</xs:complexType>
<xs:attributeGroup name="topic-metadata">
<xs:attribute name="ERulesId" type="xs:string"/>
<xs:attribute name="Domain" type="xs:string"/>
<xs:attribute name="ActivityType" type="xs:string"/>
<xs:attribute name="AircraftCategory" type="xs:string"/>
<xs:attribute name="AircraftUse" type="xs:string"/>
<xs:attribute name="AmendedBy" type="xs:string"/>
<xs:attribute name="ApplicabilityDate" type="xs:string"/>
<xs:attribute name="EntryIntoForceDate" type="xs:string"/>
<xs:attribute name="EquivalentForeignRegulation" type="xs:string"/>
<xs:attribute name="ICAOReference" type="xs:string"/>
<xs:attribute name="Keywords" type="xs:string"/>
<xs:attribute name="RegistryState" type="xs:string"/>
<xs:attribute name="RegulatedEntity" type="xs:string"/>
<xs:attribute name="RegulatorySource" type="xs:string"/>
<xs:attribute name="RegulatorySubject" type="xs:string"/>
<xs:attribute name="TechnicalSubjectMatter" type="xs:string"/>
<xs:attribute name="TypeOfContent" type="xs:string"/>
<xs:attribute name="ParentIR" type="xs:string"/>
<xs:attribute name="EASACategory" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="sdt">
<xs:attribute name="sdt-id" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="document-metadata">
<xs:attribute name="guid" type="xs:string"/>
<xs:attribute name="pub-time" type="xs:string"/>
<xs:attribute name="map-url" type="xs:string"/>
<xs:attribute name="pub-template-url" type="xs:string"/>
<xs:attribute name="xslt-url" type="xs:string"/>
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
<xs:attributeGroup name="title">
<xs:attribute name="source-title" type="xs:string"/>
</xs:attributeGroup>
</xs:schema>
Here is the beginning of the XML file (link to whole XML):
<code><?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/customXml/item1.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<CoverPageProperties xmlns="http://schemas.microsoft.com/office/2006/coverPageProps">
<PublishDate>2008</PublishDate>
<Abstract/>
<CompanyAddress/>
<CompanyPhone/>
<CompanyFax/>
<CompanyEmail/>
</CoverPageProperties>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item2.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>DocumentLibraryForm</Display>
<Edit>DocumentLibraryForm</Edit>
<New>DocumentLibraryForm</New>
</FormTemplates>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item3.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<Sources SelectedStyle="APA.XSL" StyleName="APA" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/>
</pkg:xmlData>
</pkg:part>
</code>
<code><?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/customXml/item1.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<CoverPageProperties xmlns="http://schemas.microsoft.com/office/2006/coverPageProps">
<PublishDate>2008</PublishDate>
<Abstract/>
<CompanyAddress/>
<CompanyPhone/>
<CompanyFax/>
<CompanyEmail/>
</CoverPageProperties>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item2.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>DocumentLibraryForm</Display>
<Edit>DocumentLibraryForm</Edit>
<New>DocumentLibraryForm</New>
</FormTemplates>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item3.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<Sources SelectedStyle="APA.XSL" StyleName="APA" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/>
</pkg:xmlData>
</pkg:part>
</code>
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/customXml/item1.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<CoverPageProperties xmlns="http://schemas.microsoft.com/office/2006/coverPageProps">
<PublishDate>2008</PublishDate>
<Abstract/>
<CompanyAddress/>
<CompanyPhone/>
<CompanyFax/>
<CompanyEmail/>
</CoverPageProperties>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item2.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Display>DocumentLibraryForm</Display>
<Edit>DocumentLibraryForm</Edit>
<New>DocumentLibraryForm</New>
</FormTemplates>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/customXml/item3.xml" pkg:contentType="application/xml">
<pkg:xmlData>
<Sources SelectedStyle="APA.XSL" StyleName="APA" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography"/>
</pkg:xmlData>
</pkg:part>
<code>{ Global Functions }
function Getdocument(Doc: IXMLDocument): IXMLDocumenttype;
begin
Result := Doc.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Loaddocument(const FileName: string): IXMLDocumenttype;
begin
Result := LoadXMLDocument(FileName).GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Newdocument: IXMLDocumenttype;
begin
Result := NewXMLDocument.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
</code>
<code>{ Global Functions }
function Getdocument(Doc: IXMLDocument): IXMLDocumenttype;
begin
Result := Doc.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Loaddocument(const FileName: string): IXMLDocumenttype;
begin
Result := LoadXMLDocument(FileName).GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Newdocument: IXMLDocumenttype;
begin
Result := NewXMLDocument.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
</code>
{ Global Functions }
function Getdocument(Doc: IXMLDocument): IXMLDocumenttype;
begin
Result := Doc.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Loaddocument(const FileName: string): IXMLDocumenttype;
begin
Result := LoadXMLDocument(FileName).GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
function Newdocument: IXMLDocumenttype;
begin
Result := NewXMLDocument.GetDocBinding('document', TXMLDocumenttype, TargetNamespace) as IXMLDocumenttype;
end;
This is the way I try loading the file.
<code>function TXML_Reader_Main_Form.Read_XML( Const Fn:string): Boolean;
Var EASA_Doc: IXMLDocumenttype;
begin
Result:=False;
if NOT FileExists(SYS_Base_Folder+fn)
then Exit;
//
EASA_Doc:=Loaddocument(SYS_Base_Folder+fn);
//
// more code ....
end;
</code>
<code>function TXML_Reader_Main_Form.Read_XML( Const Fn:string): Boolean;
Var EASA_Doc: IXMLDocumenttype;
begin
Result:=False;
if NOT FileExists(SYS_Base_Folder+fn)
then Exit;
//
EASA_Doc:=Loaddocument(SYS_Base_Folder+fn);
//
// more code ....
end;
</code>
function TXML_Reader_Main_Form.Read_XML( Const Fn:string): Boolean;
Var EASA_Doc: IXMLDocumenttype;
begin
Result:=False;
if NOT FileExists(SYS_Base_Folder+fn)
then Exit;
//
EASA_Doc:=Loaddocument(SYS_Base_Folder+fn);
//
// more code ....
end;
“document” appears to be element name, but it fails.
I also tried “package”, “pkg” unsuccessfully.
What I am missing?
Thank you.
Giovanni