Jacek Laskowski 57 Posted September 18, 2020 I need to validate an XML file that has references to XSD files, I use TXMLDocument for that. But during this validation, which is done in a thread, the MSXML bni library displays me a window asking for permission, it looks like this: The message in english is: "This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?" Is it possible to confirm this question from the code level or disable the message? And I know it is hidden in the internet options of the system, but I do not have access to clients' computers and I have to bypass it in the code. Share this post Link to post
FPiette 383 Posted September 18, 2020 You should post the code you use to validate the XML document. Build a minimal program which reproduce the error you get. Share this post Link to post
Jacek Laskowski 57 Posted September 18, 2020 Code: var lXML: IXMLDocument; begin lXML := TXMLDocument.Create(nil); lXML.ParseOptions := [poResolveExternals, poValidateOnParse]; lXML.LoadFromFile('test_.xml'); and test file for load: <?xml version="1.0" encoding="UTF-8"?> <tns:JPK xmlns:tns="http://jpk.mf.gov.pl/wzor/2017/11/13/1113/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:etd="http://crd.gov.pl/xml/schematy/dziedzinowe/mf/2016/01/25/eD/DefinicjeTypy/" xsi:schemaLocation="http://jpk.mf.gov.pl/wzor/2017/11/13/1113/ http://www.mf.gov.pl/documents/764034/6145258/Schemat_JPK_VAT%283%29_v1-1.xsd"> <tns:Naglowek> <tns:KodFormularza kodSystemowy="JPK_VAT (3)" wersjaSchemy="1-1">JPK_VAT</tns:KodFormularza> <tns:WariantFormularza>3</tns:WariantFormularza> <tns:CelZlozenia>0</tns:CelZlozenia> <tns:DataWytworzeniaJPK>2020-07-23T12:49:30.000Z</tns:DataWytworzeniaJPK> <tns:DataOd>2020-06-01</tns:DataOd> <tns:DataDo>2020-06-30</tns:DataDo> <tns:NazwaSystemu>test</tns:NazwaSystemu> </tns:Naglowek> </tns:JPK> Share this post Link to post
FPiette 383 Posted September 18, 2020 Using your code with Delphi 10.4.1 and your test file, I cannot reproduce the issue! Maybe something else in your application? Try with a simple project with only one button and your code in the OnClick event. Share this post Link to post
Jacek Laskowski 57 Posted September 18, 2020 The reason is in the internet settings: https://kb.froglogic.com/squish/web/troubleshoot/page-accessing-information-not-under-its-control/ When I change "Access data sources across domains" to Enable problem disappear. But how to change this or prevent from code level? Share this post Link to post
FPiette 383 Posted September 18, 2020 This is governed by a registry key: https://support.microsoft.com/en-us/help/182569/internet-explorer-security-zones-registry-entries-for-advanced-users It is likely that your program need elevated privileges to change that. Share this post Link to post
Der schöne Günther 316 Posted September 18, 2020 It appears you can use a custom security manager for xml instead of messing with global user preferences. Building a Custom Internet Security Manager | Microsoft Docs Share this post Link to post
Remy Lebeau 1394 Posted September 19, 2020 Have you considered simply changing the TXMLDocument to use a different DOMVendor than MSXML? Share this post Link to post