Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8290797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:54:59+00:00 2026-06-08T12:54:59+00:00

I have this inno script where i am trying to read a xml file

  • 0

I have this inno script where i am trying to read a xml file and change the values by giving the possibility to user to change as custom inputs.

here is the code i am using :

function LoadValueFromXML(const AFileName, APath: string): string;
var
  XMLNode: Variant;
  XMLDocument: Variant;  
begin
  Result := '';
  XMLDocument := CreateOleObject('Msxml2.DOMDocument.6.0');
  try
    XMLDocument.async := False;
    XMLDocument.load(AFileName);
    if (XMLDocument.parseError.errorCode <> 0) then
      MsgBox('The XML file could not be parsed. ' + 
        XMLDocument.parseError.reason, mbError, MB_OK)
    else
    begin
      XMLDocument.setProperty('SelectionLanguage', 'XPath');
      XMLNode := XMLDocument.selectSingleNode(APath);
      Result := XMLNode.text;
    end;
  except
    MsgBox('An error occured!', mbError, MB_OK);
  end;
end;

this is the code for calling above function to load the values from XML

 EditMailServerID.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/Mail/MailServer/');
   EditMailServerUserId.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/Mail/UserName/');
   EditMailServerPassword.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/Mail/Password/');
   EditERPBOServicePath.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/default/ERPBOWebServicePath/');
   EditERPHOServicePath.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/default/ERPHOWebServicePath/');
   EditCustomerId.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', '//settings/license/customernumber/');

sample xml code is:

<?xml version="1.0" encoding="utf-8"?>
<settings> 
  <default>
    <ReadInvoiceFile>0</ReadInvoiceFile>
    <HOUser>
    </HOUser>
    <HOShopNo>1</HOShopNo>
    <LagerShop>500</LagerShop>
    <SenderAddress>administrator@datanova.no</SenderAddress>
    <HostId>192.168.6.155</HostId>
    <PincodeDownloadFileName>tilbud5.txt</PincodeDownloadFileName>
    <PrinterName />
    <UseAverageCostPrice>true</UseAverageCostPrice>
    <ERPBOWebServicePath>http://localhost:90/FlisekompanietERPBOWebService/ERPBOService.asmx</ERPBOWebServicePath>
    <ERPHOWebServicePath>http://localhost:90/FlisekompanietERPHOWebService/ERPHOService.asmx</ERPHOWebServicePath>   
  </default>
  <license>
    <customernumber>998877</customernumber>
    <custid>532</custid>
  </license> 
  <Mail>
    <MailServer>dnserver.datanova.no</MailServer>
    <UserName>sharma</UserName>
    <Password>datanova123</Password>
  </Mail>
  <sms>
    <provider>test</provider>
    <sendername>test</sendername>
    <username>test</username>
    <password>test</password>
  </sms> 
</settings>

I get a runtime error at :

XMLDocument.setProperty('SelectionLanguage', 'XPath');
      XMLNode := XMLDocument.selectSingleNode(APath);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T12:55:00+00:00Added an answer on June 8, 2026 at 12:55 pm

    You have an extra / slash at the end of your XPath expressions when calling the function. Just remove them and you’ll get it to work. Here is the fix:

    EditMailServerID.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml', 
      '//settings/Mail/MailServer');
    EditMailServerUserId.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml',
      '//settings/Mail/UserName');
    EditMailServerPassword.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml',
      '//settings/Mail/Password');
    EditERPBOServicePath.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml',
      '//settings/default/ERPBOWebServicePath');
    EditERPHOServicePath.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml',
      '//settings/default/ERPHOWebServicePath');
    EditCustomerId.Text := LoadValueFromXML('C:\dnpr\ERPBO\Settings.xml',
      '//settings/license/customernumber');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have this in this part of Inno script [Run] Filename: {app}\bin\vcredist_x86.exe; Parameters:
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I have some commands in the [Run] section of my Inno Setup script. Right
I have this following code with Inno Setup. But how can I apply this
I am building an Inno Setup script and have libraries that need to be
I've been coding in Inno Setup this afternoon and I read some Pascal documentation
I have an Inno Setup installer for an app that offers the user a
I have a small Inno script that checks the registry for you current .Net
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.