public Object get(Object o, int i) { return ((Element)o).getAttribute(i); } };
private NodeInfo advance() { Element elem = (Element) start.node; if (cursor == elem.getAttributeCount()) { return null; } NodeInfo curr = makeWrapper(elem.getAttribute(cursor), docWrapper, start, cursor); cursor++; return curr; }
public String getAttribute(int index) { return currentElement.getAttribute(index).getValue(); }
private void substituteAttributes(Element element) { // make a copy of attribute lists as we are resetting them int attCount = element.getAttributeCount(); List<Attribute> attList = new ArrayList<Attribute>(); for (int j = 0; j < attCount; j++) { Attribute att = element.getAttribute(j); attList.add(att); } for (Attribute att : attList) { this.substituteNameByValue(att); } }
public String getAttributeName(int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
/** * copies attributes. makes subclass if necessary. * * @param element to copy from */ public void copyAttributesFrom(Element element) { for (int i = 0; i < element.getAttributeCount(); i++) { Attribute att = element.getAttribute(i); Attribute newAtt = (Attribute) att.copy(); this.addAttribute(newAtt); } }
/** * gets local value of dictRef value on element * eg dictRef="a:b" returns b * @param element * @return null id no dictRef ; value if no prefix */ public static String getLocalValue(Element element) { Attribute att = element.getAttribute(NAME); String value = (att == null) ? null : att.getValue(); String[] values = (value == null) ? null : value.split(CMLConstants.S_COLON); return (values == null) ? null : values[values.length-1]; }
public void moveAttributesTo(Element element) { for (int i=0; i<xomElement.getAttributeCount(); i++) { Attribute attribute = xomElement.getAttribute(i); xomElement.removeAttribute(attribute); element.xomElement.addAttribute(attribute); } }
private static String kindAttribute( final Element e) { final Attribute et = e.getAttribute("kind", SXML.XML_URI.toString()); assert et != null; final String r = et.getValue(); assert r != null; return r; }
public void moveAttributesTo(Element element) { for (int i=0; i<xomElement.getAttributeCount(); i++) { Attribute attribute = xomElement.getAttribute(i); xomElement.removeAttribute(attribute); element.xomElement.addAttribute(attribute); } }
private static URI sourceAttribute( final Element ec) throws URISyntaxException { final Attribute a = ec.getAttribute("source", SXML.XML_URI.toString()); return new URI(a.getValue()); }
private static String targetAttribute( final Element ec) { final Attribute a = ec.getAttribute("target", SXML.XML_URI.toString()); return a.getValue(); }
@Override public String getAttribute(final int index) { return currentElement.getAttribute(index).getValue(); }
private static @Nullable Integer heightAttribute( final Element ec) { final Attribute a = ec.getAttribute("height", SXML.XML_URI.toString()); if (a == null) { return null; } return Integer.valueOf(a.getValue()); }
private static @Nullable String typeAttribute( final Element e) { final Attribute et = e.getAttribute("type", SXML.XML_URI.toString()); if (et == null) { return null; } return et.getValue(); }
public static String parseAttributeValue(final String attributeName, final Element sourceElement) throws MissingAttributeException { Attribute attribute = sourceElement.getAttribute(attributeName); if (attribute == null) { throw new MissingAttributeException(attributeName, sourceElement); } return attribute.getValue(); }
@Override public String getAttributeName(final int index) { return decodeAttribute(currentElement.getAttribute(index).getQualifiedName()); }
private boolean hasContentTypeMetadata(Element head) { Elements metaChildren = head.getChildElements("meta"); for (int i=0; i < metaChildren.size(); i++) { Element metaChild = metaChildren.get(i); Attribute httpEquiv = metaChild.getAttribute("http-equiv"); if (httpEquiv != null && "content-type".equalsIgnoreCase(httpEquiv.getValue())) { return true; } } return false; } }
private static @Nullable SID idAttribute( final Element e) { final Attribute eid = e.getAttribute("id", "http://www.w3.org/XML/1998/namespace"); if (eid == null) { return null; } return SID.newID(eid.getValue()); }
private boolean hasContentTypeMetadata(Element head) { Elements metaChildren = head.getChildElements("meta"); for (int i=0; i < metaChildren.size(); i++) { Element metaChild = metaChildren.get(i); Attribute httpEquiv = metaChild.getAttribute("http-equiv"); if (httpEquiv != null && "content-type".equalsIgnoreCase(httpEquiv.getValue())) { return true; } } return false; } }