alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
package org.netbeans.modules.xml.xsd;

/**
 * Represents a Namespace
 * @author  anovak
 */
class Namespace {

    public static final String XMLNS_ATTR = "xmlns"; //NOI18N
    public static final String XSI_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema-instance"; //NOI18N
    public static final String XSI_LOCATION = "schemaLocation"; //NOI18N
    public static final String XSI_NO_NAMESPACE_LOCATION = "noNamespaceSchemaLocation"; //NOI18N
    public static final String XSD_SCHEMA_URI =  "http://www.w3.org/2001/XMLSchema"; // NOI18N
    
    /** Not real URI, anything will work */
    private final String uri;
    /** Prefix */
    private final String prefix;
    /** Schema Location */
    private String schemaLocation;
    /** Grammar for this Namespace */
    private XSDGrammar grammar;
    
    /** Creates a new instance of Type */
    public Namespace(String uri, String prefix) {
        this.uri = uri;
        this.prefix = prefix;
        this.schemaLocation = null;
        this.grammar = null;
    }  
    
    /**
     * Getter for property uri.
     * @return Value of property uri.
     */
    public java.lang.String getURI() {
        return uri;
    }
    
    /**
     * Getter for property prefix.
     * @return Value of property prefix.
     */
    public java.lang.String getPrefix() {
        return prefix;
    }

    public void setSchemaLocation(String location) {
        this.schemaLocation = location;
    }
    
    public String getSchemaLocation() {
        return schemaLocation;
    }
    
    /**
     * Getter for property grammar.
     * @return Value of property grammar.
     */
    public org.netbeans.modules.xml.xsd.XSDGrammar getGrammar() {
        return grammar;
    }
    
    /**
     * Setter for property grammar.
     * @param grammar New value of property grammar.
     */
    public void setGrammar(org.netbeans.modules.xml.xsd.XSDGrammar grammar) {
        this.grammar = grammar;
    }
    
    /** @ret xsdf for String of form xsdf:some_name */
    public static String getPrefix(String name) {
        int i = name.indexOf(':');
        if (i >= 0) {
            return name.substring(0, i);
        }
        
        return null;
    }
    
    /** @ret some_name for String of form xsdf:some_name */
    public static String getSufix(String name) {
        int i = name.indexOf(':');
        if (i >= 0) {
            return name.substring(i + 1);
        }
        
        return null;
    }

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.