|
-
Jan 23rd, 2008, 02:33 PM
#1
Thread Starter
New Member
html to xhtml
I would like to build a program that would go through a selected folder of .aspx source files and edit them based on the rules I defined in the program.
I haven't really found a good way to get the document's data
example of changes made
<HTML> -> <html> i would like it loop through contents of file and change the uppercase tags to lowercase without changing the data inside the tags.
I've looked at just using regex for this but i wanted to know if there where any html controls that would do this kinda thing.
thanks for the help
-
Jan 23rd, 2008, 04:06 PM
#2
Re: html to xhtml
As far as I know, there isn't an easy way to manipulate HTML in .Net. Having said that, you may want to just do a search for anything with a set of <> characters. Then, have your program create a list of items it's going to change so you can stop or edit certain ones before they're changed.
If you're changing a large site, it's probably best to have a hand in any kind of conversions just in case.
-
Jan 23rd, 2008, 06:00 PM
#3
Thread Starter
New Member
Re: html to xhtml
Dim strContents As String = stReader.ReadToEnd()
stReader.Close()
strContents = strContents.Replace("<HTML>", "<html>")
strContents = strContents.Replace("<HEAD>", "<head>")
strContents = strContents.Replace("</HEAD>", "</head>")
strContents = strContents.Replace("<BODY", "<body")
strContents = strContents.Replace("</BODY>", "</body>")
strContents = strContents.Replace("<TR", "<tr")
strContents = strContents.Replace("</TR>", "</tr>")
strContents = strContents.Replace("<TD", "<td")
strContents = strContents.Replace("</TD>", "</td>")
strContents = strContents.Replace("<BR>", "<br/>")
strContents = strContents.Replace("<BR />", "<br />")
strContents = strContents.Replace("<TABLE", "<table")
strContents = strContents.Replace("</TABLE", "</table")
' strContents.Replace("", "")
strContents = strContents.Replace("</HTML>", "</html>")
' Dim stWriter As StreamWriter
'stWriter = File.CreateText(strFileName)
'stWriter =
File.WriteAllText(strFilePath, strContents)
txtContents.Text = strContents
thats what i've come up with so far. just a note there are over 350 files
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|