All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.xerces.impl.xs.XSOpenContentDecl Maven / Gradle / Ivy

Go to download

A processor for parsing, validating, serializing and manipulating XML, written in Java

The newest version!
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.xerces.impl.xs;

import org.apache.xerces.xs.XSConstants;
import org.apache.xerces.xs.XSNamespaceItem;
import org.apache.xerces.xs.XSOpenContent;
import org.apache.xerces.xs.XSWildcard;

/**
 * The XML representation for an openContent declaration either
 * an <openContent> or a <defaultOpenContent>
 *
 * @xerces.internal 
 *
 * @author Khaled Noaman, IBM
 * @version $Id$
 */
public class XSOpenContentDecl implements XSOpenContent {

	 // the mode of the openContent
    public short fMode = MODE_NONE;
    // the appliesToEmpty flag
    public boolean fAppliesToEmpty = false;
    // the wildcard declaration
    public XSWildcardDecl fWildcard = null;
    
    /**
     * get the string description of this wildcard
     */
    private String fDescription = null;
    public String toString() {
        if (fDescription == null) {
            StringBuffer buffer = new StringBuffer();
            buffer.append("OC[mode=");
            if (fMode == MODE_NONE) {
            	buffer.append("none,");
            }
            else if (fMode == MODE_INTERLEAVE) {
            	buffer.append("interleave,");
            }
            else {
            	buffer.append("suffix,");
            }
            buffer.append(fWildcard.toString());
            buffer.append("]");
            fDescription = buffer.toString();
        }

        return fDescription;
    }

    /**
     * Get the type of the object, i.e ELEMENT_DECLARATION.
     */
    public short getType() {
        return XSConstants.OPEN_CONTENT;
    }

    /**
     * The name of this XSObject depending on the
     * XSObject type.
     */
    public String getName() {
        return null;
    }

    /**
     * The namespace URI of this node, or null if it is
     * unspecified.  defines how a namespace URI is attached to schema
     * components.
     */
    public String getNamespace() {
        return null;
    }

	/**
	 * @see org.apache.xerces.xs.XSObject#getNamespaceItem()
	 */
	public XSNamespaceItem getNamespaceItem() {
        // REVISIT: implement
		return null;
	}

    /**
     * A mode type: none, interleave, suffix. 
     */
    public short getModeType() {
    	return fMode;
    }

    /**
     * A wildcard declaration
     */
    public XSWildcard getWildcard() {
    	return fWildcard;
    }
    
    /**
     * A flag that indicates whether a default open content is applied
     * when the content type of a complex type declaration is empty
     */
    // TODO: do we have two different implementations (i.e. XSOenContentDecl and XSDefaultOpenContentDecl)
    //       and add that method only to XSDefaultOpenContentDecl
    public boolean appliesToEmpty() {
    	return fAppliesToEmpty;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy