Common.Parser Class

Description

This class contains all base parser methods that are used to parse the collected information from the Playstation Network.
The localized parser class must inherit from this class.

Class Structure

class Parser
{
    //Fields
    internal string _HtmlCode;
    internal string _InnerTextRegexPattern;
    internal string _ImageSourceRegexPattern;
    internal string _AHrefRegexPattern;

    //Constructors
    internal Parser(string htmlCode)

    //Methods
    internal string GetInnerText(string tagName, string attributeName, string attributeValue, string toRemove, string htmlCode)
    internal string GetImgSource(string knowPathPart, string htmlCode)
    internal string GetAHref(string knowPathPart, string htmlCode)
    internal string StripHtmlTags(string source)
    internal string CleanUpUrl(string source)
    internal string CorrectString(string source)
    internal int? TryParseNullableInt(string source)
}

Class Objects

Fields

_HtmlCode : string
Contains the html code that is being processed.

_InnerTextRegexPattern : string
Contains the regular expression used to collect information inside html tags.

_ImageSourceRegexPattern : string
Contains the regular expression used to collect image source.

_AHrefRegexPattern : string
Contains the regular expression used to collect links.

Constructors

Parser(htmlCode : string)
This constructor instantiate the field _HtmlCode with the value from htmlCode parameter and get the values for _InnerTextRegexPattern, _ImageSourceRegexPattern and _ImageSourceRegexPattern from the application configuration.

Methods

GetInnerText(tagName : string, attributeName : string, attributeValue : string, htmlCode : string) : string
This method get the value from inside a html tag.
- tagName : string - The name of the html tag.
- attributeName : string - The name of the attrivute of the html tag entered in tagName.
- attributeValue : string - The value of the attribute inserted in the attributeName.
- htmlCode : string - the html code used to collect the information.

GetImgSource(knowPathPart : string, htmlCode : string) : string
This method get the source value from a image tag.
- knowPathPart : string - Part of the image path that you already know.
- htmlCode : string - the html code used to collect the information.

GetAHref(knowPathPart : string, htmlCode : string) : string
this method get the href value from a html tag
- knowPathPart : string - Part of the link path that you already know.
- htmlCode : string - the html code used to collect the information.

StripHtmlTags(source : string) : string
This method removes any html tag from a string.
- source : string - The string that must have any html code removed.

CleanUpUrl(source : string) : string
This method remove any dirt from a url.
- source : string - The url that will be cleaned.

CorrectString(source : string) : string
Correct string from comming with codes instead of the correct character.
- source : string - The string that will be corrected.

TryParseNullableInt(source : string) : Nullable<int>
Try to convert a string into a integer but returns null if it's not possible.
- source : string - The string that will be converted.
Updated on Version 1.0.3852.30835.

Last edited Sep 21, 2010 at 4:25 PM by jmtvms, version 21

Comments

No comments yet.