Package org.htmlparser.tags

Examples of org.htmlparser.tags.BaseHrefTag


            // first we check to see if body tag has a
            // background set
            if (tag instanceof BodyTag) {
                binUrlStr = tag.getAttribute(ATT_BACKGROUND);
            } else if (tag instanceof BaseHrefTag) {
                BaseHrefTag baseHref = (BaseHrefTag) tag;
                String baseref = baseHref.getBaseUrl();
                try {
                    if (!baseref.equals(""))// Bugzilla 30713
                    {
                        baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseHref.getBaseUrl());
                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
View Full Code Here


                    // body tag. Peter Lin 10-9-03
                    e= body.elements();
                }
                else if (node instanceof BaseHrefTag)
                {
                    BaseHrefTag baseHref= (BaseHrefTag)node;
                    try
                    {
                        baseUrl= new URL(baseUrl, baseHref.getBaseUrl()+"/");
                    }
                    catch (MalformedURLException e1)
                    {
                        throw new HTMLParseException(e1);
                    }
View Full Code Here

        parser.addScanner(new TitleScanner("-t"));
        parser.addScanner(linkScanner.createBaseHREFScanner("-b"));
        parseAndAssertNodeCount(7);
        //Base href tag should be the 4th tag
        assertTrue(node[3] instanceof BaseHrefTag);
        BaseHrefTag baseRefTag = (BaseHrefTag) node[3];
        assertEquals(
            "Base HREF Url",
            "http://www.abc.com",
            baseRefTag.getBaseUrl());
    }
View Full Code Here

        super(name);
    }

    public void testConstruction()
    {
        BaseHrefTag baseRefTag =
            new BaseHrefTag(new TagData(0, 0, "", ""), "http://www.abc.com");
        assertEquals(
            "Expected Base URL",
            "http://www.abc.com",
            baseRefTag.getBaseUrl());
    }
View Full Code Here

        parser.registerScanners();
        parseAndAssertNodeCount(1);
        assertTrue(
            "Should be a base tag but was " + node[0].getClass().getName(),
            node[0] instanceof BaseHrefTag);
        BaseHrefTag baseTag = (BaseHrefTag) node[0];
        assertStringEquals(
            "Base Tag HTML",
            "<BASE TARGET=\"_top\">",
            baseTag.toHtml());
    }
View Full Code Here

        if (baseUrl != null && baseUrl.length() > 0)
        {
            absoluteBaseUrl = LinkProcessor.removeLastSlash(baseUrl.trim());
            processor.setBaseUrl(absoluteBaseUrl);
        }
        return new BaseHrefTag(tagData, absoluteBaseUrl);
    }
View Full Code Here

            // first we check to see if body tag has a
            // background set
            if (tag instanceof BodyTag) {
                binUrlStr = tag.getAttribute(ATT_BACKGROUND);
            } else if (tag instanceof BaseHrefTag) {
                BaseHrefTag baseHref = (BaseHrefTag) tag;
                String baseref = baseHref.getBaseUrl();
                try {
                    if (!baseref.equals(""))// Bugzilla 30713
                    {
                        baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseref);
                    }
View Full Code Here

            // first we check to see if body tag has a
            // background set
            if (tag instanceof BodyTag) {
                binUrlStr = tag.getAttribute(ATT_BACKGROUND);
            } else if (tag instanceof BaseHrefTag) {
                BaseHrefTag baseHref = (BaseHrefTag) tag;
                String baseref = baseHref.getBaseUrl().toString();
                try {
                    if (!baseref.equals(""))// Bugzilla 30713
                    {
                        baseUrl.url = new URL(baseUrl.url, baseHref.getBaseUrl());
                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
View Full Code Here

            // first we check to see if body tag has a
            // background set
            if (tag instanceof BodyTag) {
                binUrlStr = tag.getAttribute(ATT_BACKGROUND);
            } else if (tag instanceof BaseHrefTag) {
                BaseHrefTag baseHref = (BaseHrefTag) tag;
                String baseref = baseHref.getBaseUrl();
                try {
                    if (!baseref.equals(""))// Bugzilla 30713
                    {
                        baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseHref.getBaseUrl());
                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
View Full Code Here

            // first we check to see if body tag has a
            // background set
            if (tag instanceof BodyTag) {
                binUrlStr = tag.getAttribute(ATT_BACKGROUND);
            } else if (tag instanceof BaseHrefTag) {
                BaseHrefTag baseHref = (BaseHrefTag) tag;
                String baseref = baseHref.getBaseUrl();
                try {
                    if (!baseref.equals(""))// Bugzilla 30713
                    {
                        baseUrl.url = ConversionUtils.makeRelativeURL(baseUrl.url, baseHref.getBaseUrl());
                    }
                } catch (MalformedURLException e1) {
                    throw new HTMLParseException(e1);
                }
            } else if (tag instanceof ImageTag) {
View Full Code Here

TOP

Related Classes of org.htmlparser.tags.BaseHrefTag

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.