1 17 18 19 20 package org.apache.lenya.xml; 21 22 import org.w3c.dom.Attr ; 23 import org.w3c.dom.Document ; 24 import org.w3c.dom.Element ; 25 26 public class XLink { 27 28 public String type = null; 29 public String href = null; 30 public String show = null; 31 public String name = null; 32 public Element element = null; 33 34 public static final String XLINK_NAMESPACE = "http://www.w3.org/1999/xlink"; 35 public static final String ATTRIBUTE_HREF = "href"; 36 public static final String ATTRIBUTE_SHOW = "show"; 37 public static final String ATTRIBUTE_TYPE = "type"; 38 39 42 public XLink() { 43 type = "simple"; 44 show = "undefined"; 45 } 46 47 50 public XLink(Element element) { 51 this(); 52 this.element = element; 53 54 name = element.getNodeName(); 55 56 Attr hrefAttribute = element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_HREF); 57 if (hrefAttribute != null) { 58 href = hrefAttribute.getNodeValue(); 59 } 60 Attr typeAttribute = element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_TYPE); 61 if (typeAttribute != null) { 62 type = typeAttribute.getNodeValue(); 63 } 64 Attr showAttribute = element.getAttributeNodeNS(XLINK_NAMESPACE, ATTRIBUTE_SHOW); 65 if (showAttribute != null) { 66 show = showAttribute.getNodeValue(); 67 } 68 69 } 70 71 74 public Element getXLink(Document document, DOMParserFactory dpf) { 75 return (Element ) dpf.cloneNode(document, element, true); 76 } 77 78 81 public String toString() { 82 return "XLink: type=\"" 83 + type 84 + "\", HREF=\"" 85 + href 86 + "\", show=\"" 87 + show 88 + "\", name=\"" 89 + name 90 + "\""; 91 } 92 } 93 | Popular Tags |