public String getText() { return internal.getText(); }
public StreamBuilder writeElementText(String value) { if (!(current instanceof Element)) throw new IllegalStateException("Not currently an element"); Element element = (Element) current; String text = element.getText(); element.setText(text + value); return this; }
public String getName() { Element name = getNameElement(); return (name != null) ? name.getText() : null; }
public String getSimpleExtension(QName qname) { Element el = getExtension(qname); return (el != null) ? el.getText() : null; }
public String getEmail() { Element email = getEmailElement(); return (email != null) ? email.getText() : null; }
public StreamBuilder writeElementText(String value) { if (!(current instanceof Element)) throw new IllegalStateException("Not currently an element"); Element element = (Element)current; String text = element.getText(); element.setText(text + value); return this; }
public String getEmail() { Element email = getEmailElement(); return (email != null) ? email.getText() : null; }
public String getEmail() { Element email = getEmailElement(); return (email != null) ? email.getText() : null; }
public String getName() { Element name = getNameElement(); return (name != null) ? name.getText() : null; }
@Override protected boolean matchesSafely(Entry entry, Description mismatchDescription) { List<Element> verbs = entry.getExtensions(ACTIVITY_VERB); for (Element verb : verbs) { if (matcher.matches(verb.getText())) { return true; } mismatchDescription.appendText("activity:verb "); matcher.describeMismatch(verb.getText(), mismatchDescription); } return false; }
/** * Gets the text. * * @param elName the el name * * @return the text */ protected String getText(QName elName) { Element el = getExtension(elName); if (el != null) return el.getText(); return null; }
public String getName() { Element name = getNameElement(); return (name != null) ? name.getText() : null; }
private static String getRunId(final Entry entry) { final Element runIdElement = entry.getFirstChild(AtomUtils .getRunIdQName()); if (runIdElement == null) { return null; } return runIdElement.getText(); }
private static String getReplyTo(final Entry entry) { final Element replyTo = entry.getFirstChild(AtomUtils .getInReplyToQName()); if (replyTo == null) { return null; } return replyTo.getText(); }
/** * Return the textual content of the specified element * * @param element An element containing directionally-sensitive text * @return The directionally-wrapped text of the element */ public static <T extends Element> String getBidiElementText(T element) { return getBidiText(getDirection(element), element.getText()); }
@Override protected void runTest() throws Throwable { Collection collection = abdera.getFactory().newCollection(); collection.setAccept("image/png", "image/jpeg"); List<Element> children = collection.getElements(); assertThat(children).hasSize(2); assertThat(children.get(0).getQName()).isEqualTo(Constants.ACCEPT); assertThat(children.get(0).getText()).isEqualTo("image/png"); assertThat(children.get(1).getQName()).isEqualTo(Constants.ACCEPT); assertThat(children.get(1).getText()).isEqualTo("image/jpeg"); } }
/** * Return the textual content of a child element using the in-scope directionality * * @param element The parent element * @param child The XML QName of the child element * @return The directionally-wrapped text of the child element */ public static <T extends Element> String getBidiChildText(T element, QName child) { Element el = element.getFirstChild(child); return (el != null) ? getBidiText(getDirection(el), el.getText()) : null; }
/** * Use Java's built in support for bidi text to determine the base directionality of the element's text. The * response to this only indicates the *base* directionality, it does not indicate whether or not there are any RTL * characters in the text. According to the Atom Bidi spec, if the dir attribute is set explicitly, we should not do * language guessing. This restriction can be bypassed by setting ignoredir to true. */ public static <T extends Element> Direction guessDirectionFromJavaBidi(T element, boolean ignoredir) { if (!ignoredir && hasDirection(element)) return getDirection(element); return Bidi.guessDirectionFromJavaBidi(element.getText()); }
/** * Attempt to guess the base direction of an element using an analysis of the directional properties of the * characters used. This is a brute-force style approach that can achieve fairly reasonable results when the element * text consists primarily of characters with the same bidi properties. This approach is implemented by the Snarfer * feed reader as is documented at http://www.xn--8ws00zhy3a.com/blog/2006/12/right-to-left-rss According to the * Atom Bidi spec, if the dir attribute is set explicitly, we should not do language guessing. This restriction can * be bypassed by setting ignoredir to true. */ public static <T extends Element> Direction guessDirectionFromTextProperties(T element, boolean ignoredir) { if (!ignoredir && hasDirection(element)) return getDirection(element); return Bidi.guessDirectionFromTextProperties(element.getText()); }