Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/******************************************************************************
 * Copyright (c) 2015 Oracle
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Konstantin Komissarchik - initial implementation and ongoing maintenance
 ******************************************************************************/

import javax.xml.namespace.QName;

public class Main {
    public static boolean equal(final QName a, final QName b, final String defaultNamespace) {
        if (a.getLocalPart().equals(b.getLocalPart())) {
            String nsa = a.getNamespaceURI();
            String nsb = b.getNamespaceURI();

            if (nsa == null || nsa.length() == 0) {
                nsa = defaultNamespace;
            }

            if (nsb == null || nsb.length() == 0) {
                nsb = defaultNamespace;
            }

            return nsa.equals(nsb);
        }

        return false;
    }
}