Search code examples
delphixml-parsingtxmldocument

EDOMParseError ErrorCode list


Where I can find the list of EDOMParseError.ErrorCode values?

I can't find it in Delphi source or in MSDN.

For example, if I set XMLDocument.FileName to incorrect url, I've got

Error code: -2146697210
Reason:  System error: -2146697210

Where this codes are defined?


Solution

  • When using MSXML as the DOM provider for TXMLDocument, the EDOMParseError.ErrorCode value is a COM HRESULT value (MSXML is implemented as COM objects). There is no single source that documents all possible HRESULT values. Different modules are allowed to define their own custom HRESULT values.

    In this case, -2146697210 (hex 0x800C0006) is INET_E_OBJECT_NOT_FOUND (The object was not found):

    #define INET_E_OBJECT_NOT_FOUND          _HRESULT_TYPEDEF_(0x800C0006L)      
    

    This translates to an HRESULT defined via the MAKE_HRESULT() macro with a severity of SEVERITY_ERROR, a facility of FACILITY_INTERNET, and an error code of 6:

    #define INET_E_OBJECT_NOT_FOUND          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_INTERNET, 6)
    

    This particular HESULT value is documented in URL Moniker Error Codes. All HRESULT values with a facility of FACILITY_INTERNET belong to the WinInet library, which includes the UrlMon module. MSXML uses WinInet internally to download remote content.