try { String content = ((XhtmlTextConstruct)(entry.getTextContent() .getContent())).getXhtml().getBlob();
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
/** * @return a plain-text representation of this text construct, * or {@code null} in case of error */ @Override public String getPlainText() { try { StringWriter sw = new StringWriter(); XmlWriter xw = new XmlWriter(sw); xw.innerXml(xhtml.getBlob()); return HtmlToText.htmlToPlainText(sw.toString()); } catch (IOException e) { // IOException isn't very meaningful to callers, so it's better to // return null in this case. return null; } }
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
@Override public void processEndElement() throws ParseException { if (name == null) { throw new ParseException( CoreErrorDomain.ERR.nameRequired); } XmlBlob xmlBlob = getXmlBlob(); if (val != null && xmlBlob.getBlob() != null) { throw new ParseException( CoreErrorDomain.ERR.valueXmlMutuallyExclusive); } if (val == null && xmlBlob.getBlob() == null) { throw new ParseException( CoreErrorDomain.ERR.valueOrXmlRequired); } } }
/** * @return a plain-text representation of this text construct, * or {@code null} if there is no text content available. */ @Override public String getPlainText() { if (xhtml == null) { return null; } try { StringWriter sw = new StringWriter(); XmlWriter xw = new XmlWriter(sw); xw.innerXml(xhtml.getBlob()); return HtmlToText.htmlToPlainText(sw.toString()); } catch (IOException e) { // IOException isn't very meaningful to callers, so it's better to // return null in this case. return null; } }
/** * @return a plain-text representation of this text construct, * or {@code null} if there is no text content available. */ @Override public String getPlainText() { if (xhtml == null) { return null; } try { StringWriter sw = new StringWriter(); XmlWriter xw = new XmlWriter(sw); xw.innerXml(xhtml.getBlob()); return HtmlToText.htmlToPlainText(sw.toString()); } catch (IOException e) { // IOException isn't very meaningful to callers, so it's better to // return null in this case. return null; } }
/** * Generates XML corresponding to extended properties. Implementations in * extended classes should always call the base class to allow for nested * extensions. * * @param w Output writer. * * @param extProfile Extension profile for use by nested extensions. * * @throws IOException */ protected void generateExtensions(XmlWriter w, ExtensionProfile extProfile) throws IOException { for (Extension ext : nonRepeatingExtensionMap.values()) { ext.generate(w, extProfile); } for (List<Extension> extList : repeatingExtensionMap.values()) { w.startRepeatingElement(); for (Extension ext : extList) { ext.generate(w, extProfile); } w.endRepeatingElement(); } if (xmlBlob != null) { w.innerXml(xmlBlob.getBlob()); } }
/** * Generates XML corresponding to extended properties. Implementations in * extended classes should always call the base class to allow for nested * extensions. * * @param w Output writer. * * @param extProfile Extension profile for use by nested extensions. * * @throws IOException */ protected void generateExtensions(XmlWriter w, ExtensionProfile extProfile) throws IOException { for (Extension ext : nonRepeatingExtensionMap.values()) { ext.generate(w, extProfile); } for (List<Extension> extList : repeatingExtensionMap.values()) { w.startRepeatingElement(); for (Extension ext : extList) { ext.generate(w, extProfile); } w.endRepeatingElement(); } if (xmlBlob != null) { w.innerXml(xmlBlob.getBlob()); } }
/** * Generates XML corresponding to extended properties. Implementations in * extended classes should always call the base class to allow for nested * extensions. * * @param w Output writer. * * @param extProfile Extension profile for use by nested extensions. * * @throws IOException */ protected void generateExtensions(XmlWriter w, ExtensionProfile extProfile) throws IOException { for (Extension ext : nonRepeatingExtensionMap.values()) { ext.generate(w, extProfile); } for (List<Extension> extList : repeatingExtensionMap.values()) { w.startRepeatingElement(); for (Extension ext : extList) { ext.generate(w, extProfile); } w.endRepeatingElement(); } if (xmlBlob != null) { w.innerXml(xmlBlob.getBlob()); } }
xw.innerXml(xhtml.getBlob());
xw.innerXml(xhtml.getBlob());
xw.innerXml(xhtml.getBlob());
cumulative.setBase(xmlBlob.getBase()); namespaces.addAll(xmlBlob.getNamespaces()); w.write(xmlBlob.getBlob());
cumulative.setBase(xmlBlob.getBase()); namespaces.addAll(xmlBlob.getNamespaces()); w.write(xmlBlob.getBlob());
cumulative.setBase(xmlBlob.getBase()); namespaces.addAll(xmlBlob.getNamespaces()); w.write(xmlBlob.getBlob());