Stef Merlijn
asked on
Retrieve E-mail address from XML (text) file
Hi,
I need to retrieve the E-mail address (which is stored under <SMTP_Email_Address....) from the XML-file below.
Can anybody help me to write a function for this?
<?xml version="1.0" encoding="utf-16" ?>
<MessageAccount>
<Account_Name type="SZ">MyName</Account_ Name>
<Connection_Type type="DWORD">00000003</Con nection_Ty pe>
<Make_Available_Offline type="DWORD">00000001</Mak e_Availabl e_Offline>
<IMAP_Port type="DWORD">0000008f</IMA P_Port>
<IMAP_Timeout type="DWORD">0000003c</IMA P_Timeout>
<IMAP_Use_LSUB type="DWORD">00000001</IMA P_Use_LSUB >
<IMAP_Polling type="DWORD">00000001</IMA P_Polling>
<IMAP_Svr-side_Special_Fol ders type="DWORD">00000001</IMA P_Svr-side _Special_F olders>
<IMAP_Sent_Items_Folder type="SZ">Verzonden items</IMAP_Sent_Items_Fol der>
<IMAP_Drafts_Folder type="SZ">Concepten</IMAP_ Drafts_Fol der>
<IMAP_Prompt_for_Password type="DWORD">00000000</IMA P_Prompt_f or_Passwor d>
<IMAP_Dirty type="DWORD">00000000</IMA P_Dirty>
<IMAP_Poll_All_Folders type="DWORD">00000001</IMA P_Poll_All _Folders>
<POP3_Server type="SZ">pop.mypop.nl</PO P3_Server>
<POP3_User_Name type="SZ">myemail@mypop.nl </POP3_Use r_Name>
<POP3_Password2 type="BINARY">01000000d08c 9dfger6784 etc.</POP3 _Password2 >
<POP3_Port type="DWORD">0000006e</POP 3_Port>
<POP3_Secure_Connection type="DWORD">00000000</POP 3_Secure_C onnection>
<POP3_Timeout type="DWORD">0000003c</POP 3_Timeout>
<Leave_Mail_On_Server type="DWORD">00000001</Lea ve_Mail_On _Server>
<Remove_When_Deleted type="DWORD">00000001</Rem ove_When_D eleted>
<Remove_When_Expired type="DWORD">00000001</Rem ove_When_E xpired>
<Expire_Days type="DWORD">00000005</Exp ire_Days>
<POP3_Skip_Account type="DWORD">00000000</POP 3_Skip_Acc ount>
<POP3_Prompt_for_Password type="DWORD">00000000</POP 3_Prompt_f or_Passwor d>
<SMTP_Server type="SZ">smtp.mypop.nl</S MTP_Server >
<SMTP_User_Name type="SZ">#smtp.mypop.nl</ SMTP_User_ Name>
<SMTP_Use_Sicily type="DWORD">00000000</SMT P_Use_Sici ly>
<SMTP_Port type="DWORD">00000019</SMT P_Port>
<SMTP_Secure_Connection type="DWORD">00000000</SMT P_Secure_C onnection>
<SMTP_Timeout type="DWORD">0000003c</SMT P_Timeout>
<SMTP_Display_Name type="SZ">My Name</SMTP_Display_Name>
<SMTP_Email_Address type="SZ">myname@mypop.nl< /SMTP_Emai l_Address>
<SMTP_Prompt_for_Password type="DWORD">00000000</SMT P_Prompt_f or_Passwor d>
</MessageAccount>
Thank you very much for your help.
Stef
I need to retrieve the E-mail address (which is stored under <SMTP_Email_Address....) from the XML-file below.
Can anybody help me to write a function for this?
<?xml version="1.0" encoding="utf-16" ?>
<MessageAccount>
<Account_Name type="SZ">MyName</Account_
<Connection_Type type="DWORD">00000003</Con
<Make_Available_Offline type="DWORD">00000001</Mak
<IMAP_Port type="DWORD">0000008f</IMA
<IMAP_Timeout type="DWORD">0000003c</IMA
<IMAP_Use_LSUB type="DWORD">00000001</IMA
<IMAP_Polling type="DWORD">00000001</IMA
<IMAP_Svr-side_Special_Fol
<IMAP_Sent_Items_Folder type="SZ">Verzonden items</IMAP_Sent_Items_Fol
<IMAP_Drafts_Folder type="SZ">Concepten</IMAP_
<IMAP_Prompt_for_Password type="DWORD">00000000</IMA
<IMAP_Dirty type="DWORD">00000000</IMA
<IMAP_Poll_All_Folders type="DWORD">00000001</IMA
<POP3_Server type="SZ">pop.mypop.nl</PO
<POP3_User_Name type="SZ">myemail@mypop.nl
<POP3_Password2 type="BINARY">01000000d08c
<POP3_Port type="DWORD">0000006e</POP
<POP3_Secure_Connection type="DWORD">00000000</POP
<POP3_Timeout type="DWORD">0000003c</POP
<Leave_Mail_On_Server type="DWORD">00000001</Lea
<Remove_When_Deleted type="DWORD">00000001</Rem
<Remove_When_Expired type="DWORD">00000001</Rem
<Expire_Days type="DWORD">00000005</Exp
<POP3_Skip_Account type="DWORD">00000000</POP
<POP3_Prompt_for_Password type="DWORD">00000000</POP
<SMTP_Server type="SZ">smtp.mypop.nl</S
<SMTP_User_Name type="SZ">#smtp.mypop.nl</
<SMTP_Use_Sicily type="DWORD">00000000</SMT
<SMTP_Port type="DWORD">00000019</SMT
<SMTP_Secure_Connection type="DWORD">00000000</SMT
<SMTP_Timeout type="DWORD">0000003c</SMT
<SMTP_Display_Name type="SZ">My Name</SMTP_Display_Name>
<SMTP_Email_Address type="SZ">myname@mypop.nl<
<SMTP_Prompt_for_Password type="DWORD">00000000</SMT
</MessageAccount>
Thank you very much for your help.
Stef
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oh, you put that XML in a file called c:\data.xml. OR you place it in a stream and pass the stream to loadfromstream. OR you place it in astring and assign the xml.xml.text:=the string..
ASKER
I put your code in the procedure for Button1.
But xml.LoadFromFile(ExtractFi lePath(App lication.E xeName)+'T est.xml'); gives an accessviolation.
Any ideas?
But xml.LoadFromFile(ExtractFi
Any ideas?
post the entire code from button click
ASKER
I already got the solution.
xml.DOMVendor:=DomVendors. Vendors[1] ;
had to be set to
xml.DOMVendor:=DomVendors. Vendors[0] ;
xml.DOMVendor:=DomVendors.
had to be set to
xml.DOMVendor:=DomVendors.
hm.. weird.
on my sistem xml.DOMVendor:=DomVendors. Vendors[0] ; gives an error with the encoding. anyway, if it works, it's good so you can remove that line.
on my sistem xml.DOMVendor:=DomVendors.
ASKER
Thank you for your help.
The XML-file is used in Windows Vista to store E-mail accounts (*.oeaccount). Maybe that's why the 0 in stead of 1?
Anyway it works perfectly.
The XML-file is used in Windows Vista to store E-mail accounts (*.oeaccount). Maybe that's why the 0 in stead of 1?
Anyway it works perfectly.
ASKER
For other people who are interested in this code:
You should also add following units to the uses clause: XMLDOC, XMLIntf, XMLDom
You should also add following units to the uses clause: XMLDOC, XMLIntf, XMLDom