Created
March 13, 2015 14:20
-
-
Save NightWhistler/6e27af3f8b822a5ae734 to your computer and use it in GitHub Desktop.
Parse CSS links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CSSLinkHandler extends TagNodeHandler { | |
private static final Logger LOG = LoggerFactory.getLogger("CSSLinkHandler"); | |
public void handleTagNode(TagNode node, SpannableStringBuilder builder, int start, int end, SpanStack spanStack) { | |
String type = node.getAttributeByName("type"); | |
String href = node.getAttributeByName("href"); | |
LOG.debug("Found link tag: type=" + type + " and href=" + href ); | |
if ( type == null || ! type.equals("text/css") ) { | |
LOG.debug("Ignoring link of type " + type ); | |
} | |
//Load the href using HttpClient or something similar | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Register the CSSLinkHandler | |
HtmlSpanner mySpanner = new HtmlSpanner(); | |
mySpanner.registerHandler("link", new CSSLinkHandler(textLoader)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment