Java tutorial
//package com.java2s; /* * Copyright (c) 2004-2012 The YAWL Foundation. All rights reserved. * The YAWL Foundation is a collaboration of individuals and * organisations who are committed to improving workflow technology. * * This file is part of YAWL. YAWL is free software: you can * redistribute it and/or modify it under the terms of the GNU Lesser * General Public License as published by the Free Software Foundation. * * YAWL is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General * Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with YAWL. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * compares textual content of two elements which are get with * element.getChildText() content of a non-existing element is equal to * content of an element without text * * @param t1 * @param t2 * @return */ public static boolean isEqualXMLText(String t1, String t2) { if (t1 == null && t2 == null) { return true; } else if (t1 == null) { return t2.isEmpty(); } else if (t2 == null) { return t1.isEmpty(); } else { return t1.equals(t2); } } }