简体   繁体   English

如何在我的非Windows项目中阻止IDE引用Windows特定的XML单元?

[英]How do I stop the IDE from referencing Windows-specific XML units in my non-Windows project?

I want to create a Android program in Delphi XE5 to work with XML files. 我想在Delphi XE5中创建一个Android程序来处理XML文件。 I use TXMLDocument . 我使用TXMLDocument

I can't compile and run it, though, because Delphi repeatedly adds Xml.Win.msxmldom in the uses section. 但是,我无法编译和运行它,因为Delphi反复在uses部分中添加了Xml.Win.msxmldom The following error occurs: 发生以下错误:

[DCC Fatal Error] Unit1.pas(11): F1026 File not found: 'C:\\Users\\HamiD\\Documents\\RAD Studio\\Projects\\Xml.Win.msxmldom.dcu' (unit scope "Xml.Win" indicates Win32, Win64 only) [DCC致命错误] Unit1.pas(11):F1026找不到文件:'C:\\ Users \\ HamiD \\ Documents \\ RAD Studio \\ Projects \\ Xml.Win.msxmldom.dcu'(单位范围“ Xml.Win”表示Win32 ,仅限Win64)

How do I avoid using that unit in my project? 如何避免在项目中使用该单元?

In the TXMLDocument , change the DOM vendor from MSXML to ADOMXML v4 , to stop the need to use the MSXML unit. TXMLDocument ,将DOM供应商从MSXML更改为ADOMXML v4 ,以停止使用MSXML单元的需要。

This is covered in the documentation for TXMLDocument.DOMVendor . TXMLDocument.DOMVendor的文档中对此进行了介绍。 Although it mentions specifically Mac, the same applies to other FireMonkey applications on iOS and Android. 尽管它专门提到了Mac,但同样适用于iOS和Android上的其他FireMonkey应用程序。

Tip: If you are designing a FireMonkey application that is intended to run on Mac OS X, then you should perform the following steps to ensure that the compilation succeeds: 提示:如果要设计要在Mac OS X上运行的FireMonkey应用程序,则应执行以下步骤以确保编译成功:

Change DOMVendor from MSXML to ADOM XML v4. 将DOMVendor从MSXML更改为ADOM XML v4。

If the Xml.Win.msxmldom unit is in the uses clause then remove it. 如果Xml.Win.msxmldom单元位于uses子句中,则将其删除。

Compile your application for Mac OS X. 编译适用于Mac OS X的应用程序。

The documentation was modified in the XE5 version to read instead: 该文档在XE5版本中进行了修改,改为:

Tip: To use TXMLDocument in Mac OS X or Mobile applications, in the Object Inspector, set the DOMVendor property to ADOM XML v4 right after dropping this component onto the Form Designer. 提示:要在Mac OS X或Mobile应用程序中使用TXMLDocument,请在将该组件拖放到“表单设计器”之后,立即在对象检查器中将DOMVendor属性设置为ADOM XML v4。 Otherwise, the TXMLDocument component is no longer usable for iOS/Android/OSX applications. 否则,TXMLDocument组件将不再可用于iOS / Android / OSX应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM