Click here to Skip to main content
       

C#

 
AnswerRe: WebMatrix-Following PinmemberN a v a n e e t h16-Feb-13 18:00 
GeneralRe: WebMatrix-Following PinmemberBram van Kampen17-Feb-13 14:45 
GeneralRe: WebMatrix-Following PinmemberN a v a n e e t h17-Feb-13 17:10 
AnswerRe: WebMatrix-Following PinmvpDave Kreskowiak16-Feb-13 18:50 
GeneralRe: WebMatrix-Following PinmemberBram van Kampen17-Feb-13 14:50 
QuestionWebMatrix PinmemberBram van Kampen16-Feb-13 14:26 
AnswerRe: WebMatrix PinmemberN a v a n e e t h16-Feb-13 18:01 
QuestionParsing a web page to get just the <p> inner text. Pinmemberfrazzle-me16-Feb-13 6:49 
I have a method that should extract text between "paragraph" tags. But I am getting css text and javascript code also.
 
Here is my code(be kind I am self taught).
 private static string GetParagraphs(string webPage)
        {
            string subWebPage = webPage;
            int subWebPageStartIndex = 0;
            string paragraph = "";
            string paragraphs = "";
            int startIndex = 0;
            int endIndex = 0;
            while (subWebPageStartIndex < webPage.LastIndexOf("</p>"))
            {
                subWebPage = webPage.Substring(subWebPageStartIndex);
                startIndex = subWebPage.IndexOf("<p>") + 3 + subWebPageStartIndex;
                endIndex = subWebPage.IndexOf("</p>") + subWebPageStartIndex;
                paragraph = webPage.Substring(startIndex, endIndex);
                paragraphs = paragraphs + " " + paragraph; //TODO: Refactor to use StringBuilder class.
                subWebPageStartIndex = endIndex + 4;
                Debug.WriteLine(paragraph);
            }
            return paragraphs;
        }
Maybe You can see where I have messed up.Confused | :confused:
Thank You for taking the time to read this.
 
Frazzle the name say's it all


Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

John F. Woods
AnswerRe: Parsing a web page to get just the <p> inner text. PinmemberN a v a n e e t h16-Feb-13 18:32 
GeneralRe: Parsing a web page to get just the <p> inner text. Pinmemberfrazzle-me17-Feb-13 1:40 
GeneralRe: Parsing a web page to get just the <p> inner text. PinmvpRichard MacCutchan17-Feb-13 2:43 
Questionexample for using webrequest and webresopnse Pinmemberarashmousapour16-Feb-13 2:10 
QuestionRe: example for using webrequest and webresopnse PinmvpRichard MacCutchan16-Feb-13 2:33 
GeneralRe: example for using webrequest and webresopnse PinmemberPIEBALDconsult16-Feb-13 5:57 
QuestionError: No value given for one or more required parameters ? Pinmembertaibc16-Feb-13 1:18 
AnswerRe: Error: No value given for one or more required parameters ? PinmvpEddy Vluggen16-Feb-13 1:37 
GeneralRe: Error: No value given for one or more required parameters ? Pinmembertaibc16-Feb-13 1:55 
GeneralRe: Error: No value given for one or more required parameters ? PinmvpEddy Vluggen16-Feb-13 2:05 
GeneralRe: Error: No value given for one or more required parameters ? Pinmembertaibc16-Feb-13 3:59 
AnswerRe: Error: No value given for one or more required parameters ? PinmvpAbhinav S16-Feb-13 6:27 
GeneralRe: Error: No value given for one or more required parameters ? Pinmembertaibc16-Feb-13 14:47 
GeneralRe: Error: No value given for one or more required parameters ? PinmvpAbhinav S16-Feb-13 22:50 
QuestionC# not release processes [modified] Pinmemberclassy_dog15-Feb-13 9:28 
AnswerRe: C# not release processes PinmvpEddy Vluggen15-Feb-13 9:47 
GeneralRe: C# not release processes Pinmemberclassy_dog15-Feb-13 10:13 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.140905.1 | Last Updated 15 Sep 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid