Parsing an HTML File

Parsing an HTML File

Question:
I am having problems parsing an HTML tag. This entry repeats hundreds of times in this file, but withdifferent names and addresses, etc.

I need a routine that will search for for the first occuranceof a particular HTML tag (so that I can return the entire line with an input command and capture the name), return it to a variable, then continue to search for theremander of the names (it happens that “

” is useddirectly in front of every name in the file and nowhereelse), making sure to skip the ones that have already been returned.I’ve tried several things, but none have rendered the desired results.

Answer:
The first thing you’ll need to do is to read the file character by character with the Input$ function. If you just use Input #n, it will leave out most of the punctuation. Here is a section from a program I wrote to parse my bookmark file:

   Dim sTemp As String   Dim sChar As String   Open “filename.ext” For Input As #1   Do While Not EOF(1)      sChar = Input$(1, 1)      If Asc(sChar) = 13 Then         ‘ Don’t include it in string      ElseIf Asc(sChar) = 10 Then         ‘ At this point, a full line has been read         ‘ and should be processed with whatever method         ‘ you choose.         sTemp = “”      Else         sTemp = sTemp + sChar      End If   Loop   Close #1
As far as parsing the string, here is a sample loop of how to do it, assuming sTemp is your full line:
sSearch = “

“for i = 1 to len(sTemp) – len(sSearch) + 1 if mid$(sTemp, i, len(sSearch)) = sSearch then ‘ found string…do whatever exit for end ifnext i

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

©2023 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.

Sitemap