xmerge: reuse the value of node.getNodeName() and remove duplicated constants

Change-Id: Ia835139496ab8e5230a09df2caf23637a5559ba4
Reviewed-on: https://gerrit.libreoffice.org/11836
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Robert Antoni Buj i Gelonch
2014-10-07 11:14:34 +02:00
committed by Noel Grandin
parent affe79b5a9
commit 5b0e6aea60
3 changed files with 8 additions and 10 deletions

View File

@@ -38,10 +38,6 @@ import org.openoffice.xmerge.converter.xml.OfficeConstants;
*/
public final class ParaNodeIterator extends NodeIterator {
// can be expanded to an array in the future, not necessary right now
private static final String SUPPORTED_TAG1 = OfficeConstants.TAG_PARAGRAPH;
private static final String SUPPORTED_TAG2 = OfficeConstants.TAG_HEADING;
/**
* Standard constructor.
*
@@ -65,8 +61,9 @@ public final class ParaNodeIterator extends NodeIterator {
protected boolean nodeSupported(Node node) {
// can use an array later to check all possible tags for
// future expansion
String nodeName = node.getNodeName();
return node.getNodeType() == Node.ELEMENT_NODE &&
(node.getNodeName().equals(SUPPORTED_TAG1) ||
node.getNodeName().equals(SUPPORTED_TAG2));
(nodeName.equals(OfficeConstants.TAG_PARAGRAPH) ||
nodeName.equals(OfficeConstants.TAG_HEADING));
}
}

View File

@@ -61,6 +61,6 @@ public final class RowIterator extends NodeIterator {
// can use an array later to check all possible tags for
// future expansion
return node.getNodeType() == Node.ELEMENT_NODE &&
node.getNodeName().equals(OfficeConstants.TAG_TABLE_ROW);
node.getNodeName().equals(OfficeConstants.TAG_TABLE_ROW);
}
}

View File

@@ -60,9 +60,10 @@ public final class TextNodeIterator extends NodeIterator {
protected boolean nodeSupported(Node node) {
// can use an array later to check all possible tags for
// future expansion
String nodeName = node.getNodeName();
return node.getNodeType() == Node.TEXT_NODE ||
node.getNodeName().equals(OfficeConstants.TAG_SPACE) ||
node.getNodeName().equals(OfficeConstants.TAG_TAB_STOP) ||
node.getNodeName().equals(OfficeConstants.TAG_LINE_BREAK);
nodeName.equals(OfficeConstants.TAG_SPACE) ||
nodeName.equals(OfficeConstants.TAG_TAB_STOP) ||
nodeName.equals(OfficeConstants.TAG_LINE_BREAK);
}
}