Click here to Skip to main content
15,901,426 members
Home / Discussions / C#
   

C#

 
Questionclasses inheritance Pin
kabutar18-Oct-07 18:54
kabutar18-Oct-07 18:54 
AnswerRe: classes inheritance Pin
N a v a n e e t h18-Oct-07 19:24
N a v a n e e t h18-Oct-07 19:24 
GeneralRe: classes inheritance Pin
kabutar18-Oct-07 19:38
kabutar18-Oct-07 19:38 
GeneralRe: classes inheritance Pin
N a v a n e e t h18-Oct-07 19:50
N a v a n e e t h18-Oct-07 19:50 
GeneralRe: classes inheritance Pin
Malcolm Smart18-Oct-07 21:23
Malcolm Smart18-Oct-07 21:23 
QuestionHow can I drawing over fullscreen ? Pin
Khoramdin18-Oct-07 18:53
Khoramdin18-Oct-07 18:53 
AnswerRe: How can I drawing over fullscreen ? Pin
Luc Pattyn19-Oct-07 3:18
sitebuilderLuc Pattyn19-Oct-07 3:18 
QuestionHTML PARSER problem Pin
netwearcdz118-Oct-07 17:09
netwearcdz118-Oct-07 17:09 
Hello Im having a problem with trying to parse a html file and extract data and put it in to a XML file.

its creating the xml file but not putting anything in to the file it self.
<code>using System;
using System.Text;
using System.IO;
using System.Xml;

namespace HTMLPARSER
{
class DescribeHtmlContent
{
[STAThread]
static void Main(string[] args)
{
try
{
string temp;
bool htmlFile = false;

StreamReader sStream;

XmlTextWriter xmlWr = new XmlTextWriter(@"C:\Parse\HtmlContents.xml", Encoding.ASCII);
xmlWr.Formatting = Formatting.Indented;
xmlWr.WriteStartDocument();
xmlWr.WriteRaw("\n<?xml:stylesheet type=\"text/xsl\" href=\"StyleSheet.xsl\"?>");
xmlWr.WriteStartElement("describer");

DirectoryInfo dirOne = new DirectoryInfo(args[0]);

FileInfo[] listOfFiles = dirOne.GetFiles();

foreach (FileInfo file in listOfFiles)
{
if (file.Extension.ToLower().Equals(".html") || file.Extension.ToLower().Equals(".htm"))
{
htmlFile = true;
sStream = new StreamReader(file.FullName);

do
{
temp = sStream.ReadLine();
if (temp != null && temp.ToLower().IndexOf("<title>") != -1)
{
int a = temp.ToLower().IndexOf("<title>") + 7;
int b = temp.ToLower().IndexOf("</title>");

temp = temp.Substring(a, b - a);

xmlWr.WriteStartElement("file");
xmlWr.WriteElementString("name", file.Name);
xmlWr.WriteElementString("description", temp);
xmlWr.WriteElementString("path", file.DirectoryName);
xmlWr.WriteEndElement();
xmlWr.Flush();
}
}
while (temp != null);

sStream.Close();
Console.WriteLine("Reading content from file: {0}", file.FullName);
}
}
if (!htmlFile)
Console.WriteLine("No HTML file found in the directory!");
else
{
xmlWr.WriteEndElement();
xmlWr.WriteEndDocument();

xmlWr.Flush();
xmlWr.Close();
}
}
catch (Exception ex)
{
Console.WriteLine("Error: {0}", ex.Message);
}
}
}
}


</code>

Whats up with this?


AnswerRe: HTML PARSER problem Pin
N a v a n e e t h18-Oct-07 18:56
N a v a n e e t h18-Oct-07 18:56 
GeneralRe: HTML PARSER problem Pin
netwearcdz119-Oct-07 9:50
netwearcdz119-Oct-07 9:50 
QuestionHow to position controls in panel dynamically? Pin
K a b u k i18-Oct-07 16:44
K a b u k i18-Oct-07 16:44 
AnswerRe: How to position controls in panel dynamically? Pin
K a b u k i18-Oct-07 19:44
K a b u k i18-Oct-07 19:44 
QuestionColumn Totals of a data grid Pin
uppuluripavan18-Oct-07 10:29
uppuluripavan18-Oct-07 10:29 
AnswerRe: Column Totals of a data grid Pin
Malcolm Smart18-Oct-07 21:44
Malcolm Smart18-Oct-07 21:44 
AnswerRe: Column Totals of a data grid Pin
Nouman Bhatti18-Oct-07 22:05
Nouman Bhatti18-Oct-07 22:05 
QuestionCopy Folder Pin
mehrdadc4818-Oct-07 10:11
mehrdadc4818-Oct-07 10:11 
AnswerRe: Copy Folder Pin
TJoe18-Oct-07 10:26
TJoe18-Oct-07 10:26 
QuestionForm Question Pin
MumbleB18-Oct-07 8:15
MumbleB18-Oct-07 8:15 
AnswerRe: Form Question Pin
Judah Gabriel Himango18-Oct-07 8:24
sponsorJudah Gabriel Himango18-Oct-07 8:24 
AnswerRe: Form Question Pin
Patrick Etc.18-Oct-07 8:26
Patrick Etc.18-Oct-07 8:26 
AnswerRe: Form Question Pin
Abdul Qahhar18-Oct-07 9:11
Abdul Qahhar18-Oct-07 9:11 
GeneralRe: Form Question Pin
Luc Pattyn18-Oct-07 9:21
sitebuilderLuc Pattyn18-Oct-07 9:21 
GeneralRe: Form Question Pin
Abdul Qahhar18-Oct-07 9:24
Abdul Qahhar18-Oct-07 9:24 
GeneralRe: Form Question Pin
Skippums18-Oct-07 10:48
Skippums18-Oct-07 10:48 
GeneralRe: Form Question Pin
Robert Rohde18-Oct-07 13:45
Robert Rohde18-Oct-07 13:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.