/// <summary> Constructor takes in tagData, compositeTagData
 /// </summary>
 /// <param name="">tagData
 /// </param>
 /// <param name="">compositeTagData
 ///
 /// </param>
 public FormTag(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
     this.formURL       = compositeTagData.StartTag["ACTION"];
     this.formName      = compositeTagData.StartTag["NAME"];
     this.formMethod    = compositeTagData.StartTag["METHOD"];
     this.formInputList = compositeTagData.Children.SearchFor(typeof(InputTag));
 }
Example #2
0
        public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
        {
            string link     = ExtractLink(compositeTagData.StartTag, tagData.UrlBeingParsed);
            int    mailto   = link.IndexOf("mailto");
            bool   mailLink = false;

            if (mailto == 0)
            {
                // yes it is
                mailto   = link.IndexOf(":");
                link     = link.Substring(mailto + 1);
                mailLink = true;
            }
            int  javascript     = link.IndexOf("javascript:");
            bool javascriptLink = false;

            if (javascript == 0)
            {
                link           = link.Substring(11); // this magic number is "javascript:".length()
                javascriptLink = true;
            }
            string accessKey  = GetAccessKey(compositeTagData.StartTag);
            string myLinkText = compositeTagData.Children.ToString();

            LinkTag linkTag = new LinkTag(tagData, compositeTagData,
                                          new LinkData(link, myLinkText, accessKey, mailLink, javascriptLink));

            linkTag.ThisScanner = this;
            return(linkTag);
        }
        protected override Tag CreateTag(TagData tagData, Tag tag, string url)
        {
            string frameUrl  = ExtractFrameLocn(tag, url);
            string frameName = ExtractFrameName(tag, url);

            return(new FrameTag(tagData, frameUrl, frameName));
        }
Example #4
0
        protected override Tag CreateTag(TagData tagData, Tag tag, string url)
        {
            System.Collections.Hashtable table = tag.Attributes;
            string metaTagName     = (string)table["NAME"];
            string metaTagContents = (string)table["CONTENT"];
            string httpEquiv       = (string)table["HTTP-EQUIV"];

            return(new MetaTag(tagData, httpEquiv, metaTagName, metaTagContents));
        }
 /// <summary> Set the Tag with the beginning posn, ending posn and tag contents (in
 /// a tagData object.
 /// </summary>
 /// <param name="tagData">The data for this tag
 ///
 /// </param>
 public Tag(TagData tagData) : base(tagData.TagBegin, tagData.TagEnd)
 {
     this.startLine   = tagData.StartLine;
     this.tagContents = new StringBuilder();
     this.tagContents.Append(tagData.TagContents);
     this.tagLine     = tagData.TagLine;
     this.tagLines    = new string[] { tagData.TagLine };
     this.emptyXmlTag = tagData.EmptyXmlTag;
 }
Example #6
0
 /// <summary> Constructor creates a LinkTag object, which basically stores the location
 /// where the link points to, and the text it contains.
 /// <p>
 /// In order to get the contents of the link tag, use foreach (... this).
 /// <p>
 /// The following code will get all the images inside a link tag.
 /// <pre>
 /// ImageTag imageTag;
 /// foreach (Node node in linkTag.LinkData()) {
 /// if (node instanceof ImageTag) {
 /// imageTag = (ImageTag)node;
 /// // Process imageTag
 /// }
 /// }
 /// </pre>
 /// There is another mechanism available that allows for uniform extraction of images. You could do this to
 /// get all images from a web page :
 /// <pre>
 /// Vector imageCollectionVector = new Vector();
 /// foreach (Node node in parser) {
 ///     node.CollectInto(imageCollectionVector,ImageTag.IMAGE_FILTER);
 /// }
 /// </pre>
 /// The link tag processes all its contents in CollectInto().
 /// </summary>
 /// <param name="tagData">The data relating to the tag.
 /// </param>
 /// <param name="compositeTagData">The data regarding the composite structure of the tag.
 /// </param>
 /// <param name="linkData">The data specific to the link tag.
 /// </param>
 /// <seealso cref="">#linkData()
 ///
 /// </seealso>
 public LinkTag(TagData tagData, CompositeTagData compositeTagData, LinkData linkData)
     : base(tagData, compositeTagData)
 {
     this.link           = linkData.Link;
     this.linkText       = linkData.LinkText;
     this.accessKey      = linkData.AccessKey;
     this.mailLink       = linkData.MailLink;
     this.javascriptLink = linkData.JavascriptLink;
 }
        protected override Tag CreateTag(TagData tagData, Tag tag, string url)
        {
            string baseUrl         = tag["HREF"];
            string absoluteBaseUrl = "";

            if (baseUrl != null && baseUrl.Length > 0)
            {
                absoluteBaseUrl   = LinkProcessor.RemoveLastSlash(baseUrl.Trim());
                processor.BaseUrl = absoluteBaseUrl;
            }
            return(new BaseHrefTag(tagData, absoluteBaseUrl));
        }
        public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
        {
            string formUrl = ExtractFormLocn(compositeTagData.StartTag, tagData.UrlBeingParsed);

            if (formUrl != null && formUrl.Length > 0)
            {
                compositeTagData.StartTag["ACTION"] = formUrl;
            }
            if (!(stack.Count == 0) && (this == stack.Peek()))
            {
                stack.Pop();
            }
            return(new FormTag(tagData, compositeTagData));
        }
 /// <summary> Override this method to create your own tag type
 /// </summary>
 /// <param name="">tagData
 /// </param>
 /// <param name="">tag
 /// </param>
 /// <param name="">url
 /// </param>
 /// <returns> Tag
 /// Throws ParserException
 ///
 /// </returns>
 protected virtual Tag CreateTag(TagData tagData, Tag tag, string url)
 {
     return(null);
 }
 public BaseHrefTag(TagData tagData, string baseUrl) : base(tagData)
 {
     this.baseUrl = baseUrl;
 }
Example #11
0
 public HeadTag(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
 }
 /// <summary> You must override this method to create the tag of your choice upon successful parsing. Data required
 /// for construction of your tag can be found within tagData and compositeTagData
 /// </summary>
 public abstract Tag CreateTag(TagData tagData, CompositeTagData compositeTagData);
Example #13
0
 public MetaTag(TagData tagData, string httpEquiv, string metaTagName, string metaTagContents) : base(tagData)
 {
     this.httpEquiv       = httpEquiv;
     this.metaTagName     = metaTagName;
     this.metaTagContents = metaTagContents;
 }
 public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
 {
     return(null);
 }
 protected override Tag CreateTag(TagData tagData, Tag tag, string url)
 {
     return(new InputTag(tagData));
 }
Example #16
0
 public EndTag(TagData tagData) : base(tagData)
 {
 }
Example #17
0
        protected override Tag CreateTag(TagData tagData, Tag tag, string url)
        {
            string link = ExtractImageLocn(tag, url);

            return(new ImageTag(tagData, link));
        }
Example #18
0
 public Html(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
 }
 public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
 {
     return(new Html(tagData, compositeTagData));
 }
 public AnotherTag(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
 }
 public CustomTag(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
     this.tagData = tagData;
 }
 public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
 {
     return(new AnotherTag(tagData, compositeTagData));
 }
 public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
 {
     return(new BulletList(tagData, compositeTagData));
 }
Example #24
0
 public Bullet(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
 }
 public override Tag CreateTag(TagData tagData, CompositeTagData compositeTagData)
 {
     Enclosing_Instance.url = tagData.UrlBeingParsed;
     return(base.CreateTag(tagData, compositeTagData));
 }
Example #26
0
 public InputTag(TagData tagData) : base(tagData)
 {
 }
 /// <summary> Constructor creates an ImageTag object, which stores the location
 /// where the image is to be found.
 /// </summary>
 /// <param name="tagData">Specifies character position and content of the tag.
 /// </param>
 /// <param name="imageURL">Location of the image.
 ///
 /// </param>
 public ImageTag(TagData tagData, string imageURL) : base(tagData)
 {
     this.imageURL = imageURL;
 }
Example #28
0
 public CompositeTag(TagData tagData, CompositeTagData compositeTagData) : base(tagData)
 {
     this.childTags = compositeTagData.Children;
     this.startTag  = compositeTagData.StartTag;
     this.endTag    = compositeTagData.EndTag;
 }
Example #29
0
 public Div(TagData tagData, CompositeTagData compositeTagData) : base(tagData, compositeTagData)
 {
 }
 public FrameTag(TagData tagData, string frameURL, string frameName) : base(tagData)
 {
     this.frameURL  = frameURL;
     this.frameName = frameName;
 }