Hi people,
I do an application in Delphi 6, this application validate a XML document
using a Schema document and parser MSXML3.0.
My code:
procedure TForm1.Button1Click(Sender: TObject);
var
XMLDocument: TDOMDocument30;
IXMLDoc : IXMLDomDocument2;
XMLSchema : TXMLSchemaCache30;
Begin
try
XMLdocument30 := TDOMDocument30.Create(nil);
try
IXMLDoc := XMLDocument30.DefaultInterface;
IXMLDoc.async := false;
IXMLDoc.load(OpenDialog.FileName);
XMLDocument30.ConnectTo(IXMLDoc);
XMLSchema30 := TXMLSchemaCache30.Create(nil);
XMLSchema30.DefaultInterface.add('http://www.cnpq.br/2002/XSD/lattes','C:\La
ttes\Curriculo\LMPL\XSD\LMPLCurriculo.xsd');
XMLDocument30.schemas :=
XMLSchema30.DefaultInterface.get('CURRICULO-VITAE');
except
raise
EgstXMLException.Create(XMLDocument30.DefaultInterface.parseError.errorCode,
XMLDocument30.DefaultInterface.parseError.reason);
end;
if (XMLDocument30.validate.errorCode <> 0) then begin
if GstMessageDlg(msgXMLMalFormado,mtConfirmation, [mbYes, mbNo],
0,dtlXMLMalFormado,false) = mrYes then
result := true
else
result := false;
end
else
result := true;
finally
IXMLDoc := nil;
XMLDocument30 := nil;
XMLDocument30.Free;
XMLSchema30 := nil;
XMLSchema30.Free;
end;
end;
end;
When execute line "
XMLSchema30.DefaultInterface.add('http://www.cnpq.br/2002/XSD/lattes','C:\La
ttes\Curriculo\LMPL\XSD\LMPLCurriculo.xsd');". Message Error: 'Incorrect
definition for the root element in schema'.
With the Parser MSXML4.0, I don't have problems.
Can anyone help me please?
thanks
Eder
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list