1 22 package org.enhydra.kelp.common.bridge; 23 24 import org.enhydra.xml.xmlc.dom.XMLCDocument; 26 import org.w3c.dom.*; 27 28 import java.lang.reflect.Method ; 30 31 public class PrintInfoV1 extends PrintInfo { 33 34 private final String GET_URLS_METHOD = "getElementURLAttrs"; 37 public PrintInfoV1(Document doc, XMLCDocument xmlcDoc) { 39 super(doc, xmlcDoc); 40 } 41 42 45 protected void getElementURLs(Element element, XMLCDocument xmlcDoc) { 46 47 String [] attrs = new String [0]; 49 Method targetMethod = null; 50 Object [] args = new Object [1]; 51 52 args[0] = element; 53 try { 54 Method [] methods = xmlcDoc.getClass().getMethods(); 55 56 for (int i = 0; i < methods.length; i++) { 57 if (methods[i].getName().equals(GET_URLS_METHOD)) { 58 targetMethod = methods[i]; 59 break; 60 } 61 } 62 if (targetMethod != null) { 63 attrs = (String []) targetMethod.invoke(xmlcDoc, args); 64 } 65 if (attrs == null) { 66 return; } 68 for (int idx = 0; idx < attrs.length; idx++) { 69 String url = element.getAttribute(attrs[idx]); 70 71 if ((url != null) && (url.length() > 0)) { 72 urls.addElement(url); 73 } 74 } 75 } catch (Exception e) { 76 e.printStackTrace(); 77 } 78 } 79 80 } 81 | Popular Tags |