Hi, I am using a program that is ultra paranoid about start and end html
tags.
For example
<p>This is a test
<br>A new line
The above code causes the program to fail
<p>This is a test</p>
<br>A new line</br>
The above code works fine.
Does anyone have a short routine that looks for a start HTML tag and if a
matching end tag does not exist inserts an end tag? I could write one myself
but rather than reinventing the wheel and all that ;)
Thanks in advance
Mark 3 7728
Hi Mark,
If you look for a simple solution, you could then use Microsoft IE's HTML
parser which is pretty smart in dealing with non-closed tags. I'd also say
such a routine won't be short as the parser should keep track of each
non-closed tag and its context to suggest proper closing tags in proper
places.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Mark" <ma**@yahoo.com N0SPAM> wrote in message
news:bj******** **@lust.ihug.co .nz... Hi, I am using a program that is ultra paranoid about start and end html tags.
For example
<p>This is a test <br>A new line
The above code causes the program to fail
<p>This is a test</p> <br>A new line</br>
The above code works fine.
Does anyone have a short routine that looks for a start HTML tag and if a matching end tag does not exist inserts an end tag? I could write one
myself but rather than reinventing the wheel and all that ;)
Thanks in advance Mark
if you need to work with existing html then consider using tidycom or the c#
wrapper for it ( http://www.mattstan.pwp.blueyonder.c...y/tidycs.html),
if you're manipulating existing html then use the dom exposed by mshtml, if
you're creating html from scratch, then just use an xml dom.
r.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:ea******** ******@tk2msftn gp13.phx.gbl... Hi Mark,
If you look for a simple solution, you could then use Microsoft IE's HTML parser which is pretty smart in dealing with non-closed tags. I'd also say such a routine won't be short as the parser should keep track of each non-closed tag and its context to suggest proper closing tags in proper places.
-- Dmitriy Lapshin [C# / .NET MVP] X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx Bring the power of unit testing to VS .NET IDE
"Mark" <ma**@yahoo.com N0SPAM> wrote in message news:bj******** **@lust.ihug.co .nz... Hi, I am using a program that is ultra paranoid about start and end html tags.
For example
<p>This is a test <br>A new line
The above code causes the program to fail
<p>This is a test</p> <br>A new line</br>
The above code works fine.
Does anyone have a short routine that looks for a start HTML tag and if
a matching end tag does not exist inserts an end tag? I could write one myself but rather than reinventing the wheel and all that ;)
Thanks in advance Mark
Thanks for your help
Regards
Mark This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mitchua |
last post by:
I am trying to use HTML::Parser to parse an HTML file, remove all HTML tags
(including comments, etc.), replace all ENTITIES (e.g. &), and put the
result into a variable as a string. I figure HTML::Parser itself can
somehow preform the filtering, but how do I get it back as a string? I'd
appreciate some sample code if anyone has any. Sorry if this is a real n00b
question.
Thanks a lot,
Mitchua
|
by: Himanshu Garg |
last post by:
Hello,
I am using HTML::Parser to extract text from html pages from
http://bbc.co.uk/urdu/
However the encoding of the input text seems to change to some
unknown encoding in the output.
The program is given below. The HTML is in a string to keep the
example simple. The same problem appears with HTML in a file.
|
by: Himanshu Garg |
last post by:
Hello,
I am trying to pinpoint an apparent bug in HTML::Parser. The
encoding of the text seems to change incorrectly if the locale isn't
set properly.
However Parser.pm in the directory
(/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/HTML/)
doesn't seem to contain the "real" parsing statements.
|
by: WUV999U |
last post by:
Hi
I am fairly familiar in C but not much.
I want to know how I can write a html parser in C that only parses for
the image file in the html file and display or print
all the images found in the html file.
How to go about it?
|
by: Craig Kenisston |
last post by:
Hi,
Could someone recommend any decedent html parser ? All what I need to do is
to extract the links from a given page.
I've found several tools in codeproject but all seems to be a bit inmature,
yet.
I'd like to hear opinions and personal experiences with any c# html parser.
Thanks in advance.
| |
by: Mark |
last post by:
Hi, I am using a program that is ultra paranoid about start and end html
tags.
For example
<p>This is a test
<br>A new line
The above code causes the program to fail
|
by: icoba |
last post by:
Hi,
I am parsing html documents using the html parser from libxml2, and if
the encoding is included in the document it works perfectly but if it
is not, I think it does not work well (probably because I am doing
something wrong).
As it is said in http://xmlsoft.org/encoding.html the parser should
detect the encoding. So I tested it putting an utf-8 word in a file and
it does not detect it (it generates a wrong string). Example:
|
by: SEGACO |
last post by:
Hi,
Can someone tell me if C# includes something to parse HTML?
Thanks.
|
by: David Virgil Hobbs |
last post by:
Loading text strings containing HTML code into an HTML parser in a
Javascript/Jscript
I would like to know, how one would go about loading a text string
containing HTML code, so as to be able to use javascript or Jscript to
work with the HTML code in the text string, in the same way that one
works with XML code in a text string using the XML parser.
If I was able to load the text string containing the HTML code
succesfully, I would be...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |