Solved

How to display only the data I need from a tag in an XML file to a listview?

Posted on 2003-11-30
4
198 Views
Last Modified: 2010-04-05
The delphi application I created is extracting data from tag <title> of an xml document and then displays the data extracted in a listview.

My problem is not how to display the extracted data. The problem is that some of the data contained in the <title> tag is not useful to me so I don't need it to be displayed in the listview.

E.g.    2-&gt;3            useful data
         2-&gt;4            useful data
         4                     not useful
         5                     not useful

The program is extracting this type of data in a listview. I don't want the integers e.g. 4,5 to be displayed and I want e.g.  2-&gt;3,   2-&gt;4 to be displayed.

Please can somebody show me how to write a routine that displays only the data I need

Thanks
0
Comment
Question by:Elmaz
4 Comments
 
LVL 2

Accepted Solution

by:
Tussin earned 65 total points
ID: 9848542
use function strpos.

This is an example.

procedure TForm1.Button1Click(Sender: TObject);
begin
  if StrPos(PChar(Edit1.Text), '-&gt;') <> nil then
    ShowMessage('Substring found')
  else
    ShowMessage('Substring not found');
end;
0
 
LVL 1

Assisted Solution

by:roknjohn
roknjohn earned 65 total points
ID: 9851968
What is the exact critera that determines if the data is of interest to you?  e.g. the data must contain the "&" character; or, the data should not be an integer value.

Then, build a test function for the data, such as:

function IsUseful(Data: string) : boolean;
begin
  Result := Pos('&',Data)>0;
end;

Then, either apply the test before the item is added to the ListView or iterate throught the list and delete the ones that fail the test.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi 2010 Export to pdf 2 287
creating manifest for my dll that called from activex 6 98
Run video youtube webbrowse 10 57
Firemonkey android show image from resource ? 1 32
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now