Jump to content

ZDeveloper

Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

2 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ZDeveloper

    Hyper-V server as host for 3 VMS

    win 11 pro (intel 13700/64gb/2Tx2 ssd) vmware workstation 17 pro + all projects in VM's 3 vm simultaneously launched, works great
  2. ZDeveloper

    Convert Png To ico fmx delphi

    easy mainicon tool generator https://convertico.com/
  3. ZDeveloper

    Validating an XML using XSD

    its my own class for generating output xml about errors in source file you can take only this part try FXMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0') as IXMLDomDocument2; FXMLDOMSchema := CreateOleObject('Msxml2.XMLSchemaCache.6.0') as IXMLDOMSchemaCollection2; FXMLDOMSchema.add('', xsd_file); FXMLDocument.Async := false; FXMLDocument.resolveExternals:= false; FXMLDocument.validateOnParse := false; FXMLDocument.setProperty('MultipleErrorMessages', true); FXMLDocument.load(xml_file); FXMLDocument.schemas := FXMLDOMSchema; FXMLParserError := FXMLDocument.validate as IXMLDOMParseError2; and part for error check finally if (FXMLParserError.errorCode <> 0) then begin ////////////////////////////////////////////////// with FXMLParserError.allErrors do for i:= 0 to Length - 1 do //// here you can log errors or doing somethings else
  4. ZDeveloper

    Validating an XML using XSD

    procedure TImportExport.CheckXMLByXSD(xml_file, xsd_file: string; out FileName: string); var FXMLDocument: IXMLDOMDocument2; FXMLDOMSchema: IXMLDOMSchemaCollection2; FXMLParserError: IXMLDOMParseError2; s: string; i: integer; flk: IXMLFLK_PType; begin FileName:= ''; try FXMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0') as IXMLDomDocument2; FXMLDOMSchema := CreateOleObject('Msxml2.XMLSchemaCache.6.0') as IXMLDOMSchemaCollection2; FXMLDOMSchema.add('', xsd_file); FXMLDocument.Async := false; FXMLDocument.resolveExternals:= false; FXMLDocument.validateOnParse := false; FXMLDocument.setProperty('MultipleErrorMessages', true); FXMLDocument.load(xml_file); FXMLDocument.schemas := FXMLDOMSchema; FXMLParserError := FXMLDocument.validate as IXMLDOMParseError2; finally if (FXMLParserError.errorCode <> 0) then begin s:= ''; flk:= NewFLK_P; flk.FNAME:= ReplaceFirstChar(ExtractFileName(xml_file),'V'); flk.FNAME_I:= ExtractFileName(xml_file); with FXMLParserError.allErrors do for i:= 0 to Length - 1 do begin with flk.PR.Add do begin case Item[i].ErrorCode of -1072897535: OSHIB:= 903; -1072898028: OSHIB:= 902; end; BAS_EL:= Item[i].errorXPath; COMMENT:= StringReplace(Item[i].reason, #13#10, '', [rfReplaceAll]); end; s:= s + Format('ErrorCode: %d' + #13#10 + 'Reason: %s' + #13#10 + 'SrcText: %s' + #13#10 + 'Line: %d' + #13#10 + 'LinePos: %d' + #13#10 + 'FilePos: %d' + #13#10 + 'XPath: %s', [Item[i].ErrorCode, Item[i].reason, Item[i].Srctext, Item[i].Line, Item[i].LinePos, Item[i].FilePos, Item[i].errorXPath])+ #13#10; end; FileName:= TempFolder + ReplaceFirstChar(ExtractFileName(xml_file),'V'); flk.OwnerDocument.LoadFromXML(XMLDoc.FormatXMLData(flk.OwnerDocument.XML.Text)); flk.OwnerDocument.SaveToFile(FileName); raise Exception.Create('Файл ' + ExtractFileName(xml_file) + ' не соответствует своей XSD схеме ' + ExtractFileName(xsd_file) + #13#10 + s); end; FXMLParserError:= nil; FXMLDOMSchema:= nil; FXMLDocument:= nil; end; end; from project 🙂
  5. ZDeveloper

    XML validation

    you can easy do it with validation by XSD scheme
  6. ZDeveloper

    Microsoft OLEDB Provider for SQL , DateTime2 Field

    why not FireDAC?
×