Programming tutorials online .NET, Java, C++, Visual Basic, and More
 

Home
.NET Tutorials
General Programming Tutorials
Community/Forums
Site Extras

 

General Forum
 

Un-moderated developer's forum for discussing any programming topics, languages, issues or whatever you feel like.


POST REPLY
Posted By: artViper   5/7/2006 12:30:00 PM
Reply To: [email protected] who posted...
 
you might wish to try this, it strips tags from xml files. Guess some modifications are needed:

using System;
using System.IO;
using System.Text.RegularExpressions;

public class StripTags {
private static string STRIPTAGS_VERSION = "0.1";

public static int Main (String[] arguments) {
if (arguments.GetLength(0) == 0) {
printUsage();
return 0;
}
else if (arguments[0].Equals("--version")) {
printVersion();
return 0;
}
else if (arguments[0].Equals("--help")) {
printUsage();
return 0;
}
else {
stripTags(arguments);
}
return 0;
}

private static void stripTags(String[] tags) {
String allConsoleInput = new StreamReader(Console.OpenStandardInput()).ReadToEnd();

for (int tagCounter = 0; tagCounter Regex tagOpenRegex = new Regex("]*>");
allConsoleInput = tagOpenRegex.Replace(allConsoleInput, "");
// Will create a new string each time; TODO: optimize.

Regex tagCloseRegex = new Regex("" + tags[tagCounter] + "[^>]*>");
allConsoleInput = tagCloseRegex.Replace(allConsoleInput, "");
// Will create a new string each time; TODO: optimize.
}

Console.WriteLine(allConsoleInput);
}



 
Sign In
Email
Password
  Forgot my password

Search

Featured Book

Introducing Microsoft .Net, Third Edition ($19.79)
Introducing Microsoft .Net, Third Edition


Featured Software

Microsoft Visual Studio Standard 2005 ($249.99)
Microsoft Visual Studio Standard 2005





 
© 2022 Ammastore.org
All Rights Reserved
COMPUTER SCIENCE HOMEWORK | Privacy/Disclaimer