private Paragraph processParagraph(Node paragraph, boolean expandURLs) { NodeList children = paragraph.getChildNodes(); NamedNodeMap atts = paragraph.getAttributes(); Node addSpaceAtt = atts.getNamedItem("addVerticalSpace"); //$NON-NLS-1$ boolean addSpace = true; if (addSpaceAtt == null) addSpaceAtt = atts.getNamedItem("vspace"); //$NON-NLS-1$ if (addSpaceAtt != null) { String value = addSpaceAtt.getNodeValue(); addSpace = value.equalsIgnoreCase("true"); //$NON-NLS-1$ } Paragraph p = new Paragraph(addSpace); processSegments(p, children, expandURLs); return p; }
private Paragraph processParagraph(Node paragraph, boolean expandURLs) { NodeList children = paragraph.getChildNodes(); NamedNodeMap atts = paragraph.getAttributes(); Node addSpaceAtt = atts.getNamedItem("addVerticalSpace"); //$NON-NLS-1$ boolean addSpace = true; if (addSpaceAtt == null) addSpaceAtt = atts.getNamedItem("vspace"); //$NON-NLS-1$ if (addSpaceAtt != null) { String value = addSpaceAtt.getNodeValue(); addSpace = value.equalsIgnoreCase("true"); //$NON-NLS-1$ } Paragraph p = new Paragraph(addSpace); processSegments(p, children, expandURLs); return p; }
public void parseRegularText(String regularText, boolean convertURLs) { reset(); if (regularText == null) return; regularText = getNormalizedText(regularText); Paragraph p = new Paragraph(true); paragraphs.add(p); int pstart = 0; for (int i = 0; i < regularText.length(); i++) { char c = regularText.charAt(i); if (p == null) { p = new Paragraph(true); paragraphs.add(p); } if (c == '\n') { String text = regularText.substring(pstart, i); pstart = i + 1; p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); p = null; } } if (p != null) { // no new line String text = regularText.substring(pstart); p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); } }
private void processSubnodes(Vector<Paragraph> plist, NodeList children, boolean expandURLs) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { // Make an implicit paragraph String text = getSingleNodeText(child); if (text != null && !isIgnorableWhiteSpace(text, true)) { Paragraph p = new Paragraph(true); p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), null); plist.add(p); } } else if (child.getNodeType() == Node.ELEMENT_NODE) { String tag = child.getNodeName().toLowerCase(); if (tag.equals("p")) { //$NON-NLS-1$ Paragraph p = processParagraph(child, expandURLs); if (p != null) plist.add(p); } else if (tag.equals("li")) { //$NON-NLS-1$ Paragraph p = processListItem(child, expandURLs); if (p != null) plist.add(p); } } } }
private void processSubnodes(Vector<Paragraph> plist, NodeList children, boolean expandURLs) { for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE) { // Make an implicit paragraph String text = getSingleNodeText(child); if (text != null && !isIgnorableWhiteSpace(text, true)) { Paragraph p = new Paragraph(true); p.parseRegularText(text, expandURLs, true, getHyperlinkSettings(), null); plist.add(p); } } else if (child.getNodeType() == Node.ELEMENT_NODE) { String tag = child.getNodeName().toLowerCase(); if (tag.equals("p")) { //$NON-NLS-1$ Paragraph p = processParagraph(child, expandURLs); if (p != null) plist.add(p); } else if (tag.equals("li")) { //$NON-NLS-1$ Paragraph p = processListItem(child, expandURLs); if (p != null) plist.add(p); } } } }
public void parseRegularText(String regularText, boolean convertURLs) { reset(); if (regularText == null) return; regularText = getNormalizedText(regularText); Paragraph p = new Paragraph(true); paragraphs.add(p); int pstart = 0; for (int i = 0; i < regularText.length(); i++) { char c = regularText.charAt(i); if (p == null) { p = new Paragraph(true); paragraphs.add(p); } if (c == '\n') { String text = regularText.substring(pstart, i); pstart = i + 1; p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); p = null; } } if (p != null) { // no new line String text = regularText.substring(pstart); p.parseRegularText(text, convertURLs, true, getHyperlinkSettings(), null); } }