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:
committed by
Noel Grandin
parent
affe79b5a9
commit
5b0e6aea60
@@ -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));
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user