public String getAttributeValue(String name) { return internal.getAttributeValue(name); }
public String getAttributeValue(String name) { return internal.getAttributeValue(name); }
public String getAttributeValue(QName qname) { return internal.getAttributeValue(qname); }
public String getAttributeValue(QName qname) { return internal.getAttributeValue(qname); }
protected boolean isMatch(Element el) { if (attribute != null) { String val = el.getAttributeValue(attribute); return ((val == null && value == null) || (val == null && value != null && value.equals(defaultValue)) || (val != null && val .equals(value))); } return true; } }
protected boolean isMatch(Element el) { if (attribute != null) { String val = FOMLink.getRelEquiv(el.getAttributeValue(attribute)); return ((val == null && value == null) || (val == null && value != null && value .equalsIgnoreCase(defaultValue)) || (val != null && val.equalsIgnoreCase(value))); } return true; } }
public Map<String, String> getAcceptMultiparted() { Map<String, String> accept = new HashMap<String, String>(); Iterator<?> i = getChildrenWithName(ACCEPT); if (i == null || !i.hasNext()) i = getChildrenWithName(PRE_RFC_ACCEPT); while (i.hasNext()) { Element e = (Element)i.next(); String t = e.getText(); if (t != null) { if (e.getAttributeValue(ALTERNATE) != null && e.getAttributeValue(ALTERNATE).trim().length() > 0) { accept.put(t.trim(), e.getAttributeValue(ALTERNATE)); } else { accept.put(t.trim(), null); } } } return accept; }
private static void getPositionAttributes(Element pos, Position position) { if (position != null) { String featuretypetag = pos.getAttributeValue("featuretypetag"); String relationshiptag = pos.getAttributeValue("relationshiptag"); String elevation = pos.getAttributeValue("elev"); String floor = pos.getAttributeValue("floor"); String radius = pos.getAttributeValue("radius"); if (featuretypetag != null) position.setFeatureTypeTag(featuretypetag); if (featuretypetag != null) position.setRelationshipTag(relationshiptag); if (elevation != null) position.setElevation(Double.valueOf(elevation)); if (floor != null) position.setFloor(Double.valueOf(floor)); if (radius != null) position.setRadius(Double.valueOf(radius)); } }
@Override public String getLanguage() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el != null && el.getAttributeValue(LANG) != null) return el.getAttributeValue(LANG); } return super.getLanguage(); }
@Override public String getLanguage() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el.getAttributeValue(LANG) != null) return el.getAttributeValue(LANG); } return super.getLanguage(); }
private static <T extends Element> boolean hasDirection(T element) { String dir = element.getAttributeValue("dir"); if (dir != null && dir.length() > 0) return true; else if (dir == null) { // if the direction is unspecified on this element, // let's see if we've inherited it Base parent = element.getParentElement(); if (parent != null && parent instanceof Element) return hasDirection((Element)parent); } return false; } }
/** * Return the text content of the specified attribute using the in-scope directionality * * @param element The parent element * @param name the name of the attribute * @return The directionally-wrapped text of the attribute */ public static <T extends Element> String getBidiAttributeValue(T element, String name) { return getBidiText(getDirection(element), element.getAttributeValue(name)); }
/** * Return the text content of the specified attribute using the in-scope directionality * * @param element The parent element * @param name the name of the attribute * @return The directionally-wrapped text of the attribute */ public static <T extends Element> String getBidiAttributeValue(T element, QName name) { return getBidiText(getDirection(element), element.getAttributeValue(name)); }
@Override public IRI getResolvedBaseUri() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el != null) { if (el.getAttributeValue(BASE) != null) { return super.getResolvedBaseUri().resolve(el.getAttributeValue(BASE)); } } } return super.getResolvedBaseUri(); }
@Override protected void runTest() throws Throwable { Element element = abdera.getFactory().newElement(new QName("test")); element.setAttributeValue(qname, "value"); assertThat(element.getAttributeValue(qname)).isEqualTo("value"); List<QName> attrs = element.getAttributes(); assertThat(attrs).hasSize(1); QName actualQName = attrs.get(0); assertThat(actualQName).isEqualTo(qname); assertThat(actualQName.getPrefix()).isEqualTo(qname.getPrefix()); } }
@Override public IRI getResolvedBaseUri() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el != null) { if (el.getAttributeValue(BASE) != null) { return super.getResolvedBaseUri().resolve(el.getAttributeValue(BASE)); } } } return super.getResolvedBaseUri(); }
/** * Get the in-scope direction for an element. */ public static <T extends Element> Direction getDirection(T element) { Direction direction = Direction.UNSPECIFIED; String dir = element.getAttributeValue("dir"); if (dir != null && dir.length() > 0) direction = Direction.valueOf(dir.toUpperCase()); else if (dir == null) { // if the direction is unspecified on this element, // let's see if we've inherited it Base parent = element.getParentElement(); if (parent != null && parent instanceof Element) direction = getDirection((Element)parent); } return direction; }
@Override public IRI getBaseUri() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el != null) { if (el.getAttributeValue(BASE) != null) { if (getAttributeValue(BASE) != null) return super.getBaseUri().resolve(el.getAttributeValue(BASE)); else return _getUriValue(el.getAttributeValue(BASE)); } } } return super.getBaseUri(); }
@Override public IRI getBaseUri() { if (Type.XHTML.equals(type)) { Element el = getValueElement(); if (el != null) { if (el.getAttributeValue(BASE) != null) { if (getAttributeValue(BASE) != null) return super.getBaseUri().resolve(el.getAttributeValue(BASE)); else return _getUriValue(el.getAttributeValue(BASE)); } } } return super.getBaseUri(); }
protected void process(Object source, ObjectContext objectContext, SerializationContext context, Conventions conventions) { StreamWriter sw = context.getStreamWriter(); if (!(source instanceof Element)) return; Element element = (Element)source; sw.startElement(element.getQName()); for (QName attr : element.getAttributes()) sw.writeAttribute(attr, element.getAttributeValue(attr)); XPath xpath = context.getAbdera().getXPath(); List<?> children = xpath.selectNodes("node()", element); for (Object child : children) { if (child instanceof Element) { process(child, new ObjectContext(child), context, conventions); } else if (child instanceof Comment) { Comment comment = (Comment)child; sw.writeComment(comment.getText()); } else if (child instanceof ProcessingInstruction) { ProcessingInstruction pi = (ProcessingInstruction)child; sw.writePI(pi.getText(), pi.getTarget()); } else if (child instanceof TextValue) { TextValue tv = (TextValue)child; sw.writeElementText(tv.getText()); } } sw.endElement(); }