/** * Assumes the <content> element's contents are plain-text and returns its * value as a string * * @return A string containing the plain-text value of the content tag. * * @throws IllegalStateException If the content element is not a text type. */ public String getPlainTextContent() { TextContent content = getTextContent(); return (content == null) ? null : content.getPlainText(); }
/** * Assumes the <content> element's contents are plain-text and returns its * value as a string * * @return A string containing the plain-text value of the content tag. * * @throws IllegalStateException If the content element is not a text type. */ public String getPlainTextContent() { TextContent content = getTextContent(); return (content == null) ? null : content.getPlainText(); }
/** * Assumes the <content> element's contents are plain-text and * returns its value as a string * * @return A string containing the plain-text value of the content tag. * * @throws IllegalStateException * If the content element is not a text type. */ public String getPlainTextContent() { TextContent content = getTextContent(); return (content == null) ? null : content.getPlainText(); }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public Collection setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); return this; }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public Collection setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); return this; }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public Collection setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); return this; }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public void setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public void setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); }
/** * Sets the title. * * @param title title or <code>null</code> to reset */ public void setTitle(TextContent title) { setAttributeValue(TITLE, (title == null ? null : title.getPlainText())); super.setElement(Source.TITLE, title); }
@Override public Element resolve(ElementMetadata<?, ?> meta, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); // Make sure that the title is in both the attribute and element. if (titleAttribute != null) { if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); // Verify that the attribute and element have the same value. if (!titleAttribute.equals(titleContent)) { vc.addError(this, CoreErrorDomain.ERR.duplicateTitle); } } } else if (title != null) { titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); } return super.resolve(meta, vc); }
@Override public Element resolve(ElementMetadata<?, ?> meta, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); // Make sure that the title is in both the attribute and element. if (titleAttribute != null) { if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); // Verify that the attribute and element have the same value. if (!titleAttribute.equals(titleContent)) { vc.addError(this, CoreErrorDomain.ERR.duplicateTitle); } } } else if (title != null) { titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); } return super.resolve(meta, vc); }
@Override public Element resolve(ElementMetadata<?, ?> meta, ValidationContext vc) { String titleAttribute = getAttributeValue(TITLE); TextContent title = getElement(Source.TITLE); // Make sure that the title is in both the attribute and element. if (titleAttribute != null) { if (title == null) { title = TextContent.plainText(titleAttribute); addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); // Verify that the attribute and element have the same value. if (!titleAttribute.equals(titleContent)) { vc.addError(this, CoreErrorDomain.ERR.duplicateTitle); } } } else if (title != null) { titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute); } return super.resolve(meta, vc); }
addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute);
addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute);
addElement(Source.TITLE, title); } else { String titleContent = title.getPlainText(); titleAttribute = title.getPlainText(); setAttributeValue(TITLE, titleAttribute);
@Override public boolean startElement(XmlWriter xw, Element parent, Element e, ElementMetadata<?, ?> metadata) throws IOException { boolean isIcon = e.getElementId().equals(Source.ICON.getId()); boolean isLogo = e.getElementId().equals(Source.LOGO.getId()); if ((!isIcon && !isLogo) || !(parent instanceof Source)) { return super.startElement(xw, parent, e, metadata); } Source source = (Source) parent; if (isIcon && source.hasElement(Source.LOGO)) { // atom:logo takes precedence return false; } xw.startElement(Namespaces.rssNs, "image", null, null); xw.simpleElement(Namespaces.rssNs, "url", null, String.valueOf(e.getTextValue())); TextContent title = source.getTitle(); if (title != null) { xw.simpleElement(Namespaces.rssNs, "title", null, title.getPlainText()); } Link htmlLink = source.getHtmlLink(); if (htmlLink != null) { xw.simpleElement(Namespaces.rssNs, "link", null, htmlLink.getHref()); } xw.endElement(Namespaces.rssNs, "image"); return false; }
@Override public boolean startElement(XmlWriter xw, Element parent, Element e, ElementMetadata<?, ?> metadata) throws IOException { boolean isIcon = e.getElementId().equals(Source.ICON.getId()); boolean isLogo = e.getElementId().equals(Source.LOGO.getId()); if ((!isIcon && !isLogo) || !(parent instanceof Source)) { return super.startElement(xw, parent, e, metadata); } Source source = (Source) parent; if (isIcon && source.hasElement(Source.LOGO)) { // atom:logo takes precedence return false; } xw.startElement(Namespaces.rssNs, "image", null, null); xw.simpleElement(Namespaces.rssNs, "url", null, String.valueOf(e.getTextValue())); TextContent title = source.getTitle(); if (title != null) { xw.simpleElement(Namespaces.rssNs, "title", null, title.getPlainText()); } Link htmlLink = source.getHtmlLink(); if (htmlLink != null) { xw.simpleElement(Namespaces.rssNs, "link", null, htmlLink.getHref()); } xw.endElement(Namespaces.rssNs, "image"); return false; }
@Override public boolean startElement(XmlWriter xw, Element parent, Element e, ElementMetadata<?, ?> metadata) throws IOException { boolean isIcon = e.getElementId().equals(Source.ICON.getId()); boolean isLogo = e.getElementId().equals(Source.LOGO.getId()); if ((!isIcon && !isLogo) || !(parent instanceof Source)) { return super.startElement(xw, parent, e, metadata); } Source source = (Source) parent; if (isIcon && source.hasElement(Source.LOGO)) { // atom:logo takes precedence return false; } xw.startElement(Namespaces.rssNs, "image", null, null); xw.simpleElement(Namespaces.rssNs, "url", null, String.valueOf(e.getTextValue())); TextContent title = source.getTitle(); if (title != null) { xw.simpleElement(Namespaces.rssNs, "title", null, title.getPlainText()); } Link htmlLink = source.getHtmlLink(); if (htmlLink != null) { xw.simpleElement(Namespaces.rssNs, "link", null, htmlLink.getHref()); } xw.endElement(Namespaces.rssNs, "image"); return false; }