Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2002-2005 IBM Corporation and others.
 * 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:
 *   IBM - Initial API and implementation
 *******************************************************************************/

import javax.xml.namespace.QName;

public class Main {
    /**
     * Create QName.
     * 
     * @param qnameString a qualified name.
     * @return a QName object.
     */
    public static QName createQName(String qnameString) {
        QName qname = null;

        // Locate local part
        int index = qnameString.lastIndexOf(":");

        // Create new QName
        if (index != -1) {
            qname = new QName(qnameString.substring(0, index), qnameString.substring(index + 1));
        }

        else {
            qname = new QName(qnameString);
        }

        return qname;
    }
}