/** * This will handle printing of <code>{@link Text}</code> strings. * * @param text <code>Text</code> to write. * @param out <code>Writer</code> to use. */ protected void printText(Writer out, Text text) throws IOException { String str=(currentFormat.mode == Format.TextMode.NORMALIZE) ? text.getTextNormalize() : ((currentFormat.mode == Format.TextMode.TRIM) ? text.getText().trim() : text.getText()); out.write(escapeElementEntities(str)); }
if (!"".equals(text.getTextNormalize()))
/** * This will handle printing of <code>{@link Text}</code> strings. * * @param text <code>Text</code> to write. * @param out <code>Writer</code> to use. */ protected void printText(Writer out, Text text) throws IOException { String str = (currentFormat.mode == Format.TextMode.NORMALIZE) ? text.getTextNormalize() : ((currentFormat.mode == Format.TextMode.TRIM) ? text.getText().trim() : text.getText()); out.write(escapeElementEntities(str)); }
/** * This will handle printing of <code>{@link Text}</code> strings. * * @param text <code>Text</code> to write. * @param out <code>Writer</code> to use. */ protected void printText( Writer out, Text text ) throws IOException { String str = ( currentFormat.mode == Format.TextMode.NORMALIZE ) ? text.getTextNormalize() : ( ( currentFormat.mode == Format.TextMode.TRIM ) ? text.getText().trim() : text.getText() ); out.write( escapeElementEntities( str ) ); }
private static void getText(Content node, StringBuilder builder) { if (node instanceof Element) { Element elem = (Element)node; List<Content> children = elem.getContent(); if (children != null && children.size() > 0) { for (Content child : children) { getText(child, builder); } } } else if (node instanceof Text) { String textVal = StringUtils.trim(((Text)node).getTextNormalize() + " "); if (StringUtils.isNotBlank(textVal)) { String escaped = StringEscapeUtils.unescapeXml(textVal); builder.append(escaped + " "); } } else if (node instanceof Comment) { return; } }
String normalized = text.getTextNormalize(); if (StringUtils.isNotBlank(normalized)) { boolean hasText = StringUtils.isNotBlank(normalized);
private XMLNode createTreeNode(Content content) { XMLNode node = new XMLNode(content); if (content instanceof Parent) { Parent parent = (Parent) content; Iterator children = parent.getContent().iterator(); while (children.hasNext()) { Object child = children.next(); if (child instanceof Element) { node.add(createTreeNode((Content) child)); } else if (textSizeLimit != 0 && child instanceof Text) { Text text = (Text) child; if (!text.getTextNormalize().equals("")) { node.add(createTreeNode(text)); } } } } return node; } }
@SuppressWarnings("unchecked") private XMLNode createTreeNode(Content content) { XMLNode node = new XMLNode(content); if (content instanceof Parent) { Parent parent = (Parent) content; Iterator children = parent.getContent().iterator(); while (children.hasNext()) { Object child = children.next(); if (child instanceof Element) { node.add(createTreeNode((Content) child)); } else if (textSizeLimit != 0 && child instanceof Text) { Text text = (Text) child; if (!text.getTextNormalize().equals("")) { node.add(createTreeNode(text)); } } } } return node; } }
addExtractedValue(key, ((Text)val).getTextNormalize());
addExtractedValue(xpath, ((Text)objNode).getTextNormalize());
/** * Extracts Interactor Name */ private void extractInteractorName(ProteinInteractorType cProtein, Interactor interactor) throws MapperException { NamesType names = cProtein.getNames(); if (names != null) { String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs()); // Remove all surrounding and internal white space. Text jdomText = new Text(name); name = jdomText.getTextNormalize(); interactor.setName(name); String fullName = names.getFullName(); interactor.addAttribute(InteractorVocab.FULL_NAME, fullName); } }
/** * Extracts Interactor Name */ private void extractInteractorName(InteractorElementType cProtein, Interactor interactor) throws MapperException { NamesType names = cProtein.getNames(); if (names != null) { String name = MapperUtil.extractName(cProtein, interactor.getExternalRefs()); // Remove all surrounding and internal white space. Text jdomText = new Text(name); name = jdomText.getTextNormalize(); interactor.setName(name); String fullName = names.getFullName(); interactor.addAttribute(InteractorVocab.FULL_NAME, fullName); } }