1 16 package com.blandware.atleap.common.parsers.html; 17 18 import java.io.Reader ; 19 import java.io.IOException ; 20 import java.util.HashMap ; 21 import java.util.ArrayList ; 22 import java.util.List ; 23 24 25 33 class InlineResourcesParser extends HTMLParser { 34 protected List resourceList; 35 36 41 public InlineResourcesParser(Reader reader) { 42 super(reader, null, false, null); 43 resourceList = new ArrayList (); 44 } 45 46 protected void addText(String text) throws IOException {} 47 48 protected void addSpace() throws IOException {} 49 50 57 protected void considerText(String text) throws IOException { 58 resourceList.add(text); 59 } 60 61 66 protected void considerSpace() throws IOException {} 67 68 protected void processTag(String tagName, HashMap attributes, 69 boolean closing) throws IOException { 70 if (tagName.equalsIgnoreCase("<img")) { 71 checkoutAttribute(attributes, "src"); 72 } else if (tagName.equalsIgnoreCase("<link")) { 73 checkoutAttribute(attributes, "src"); 74 checkoutAttribute(attributes, "href"); 75 } 76 checkoutAttribute(attributes, "background"); 77 } 78 79 public List getExtractedResources() { 80 return resourceList; 81 } 82 } 83 | Popular Tags |