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

src.java.com.ctc.wstx.dtd.ContentSpec Maven / Gradle / Ivy

/* Woodstox XML processor
 *
 * Copyright (c) 2004 Tatu Saloranta, [email protected]
 *
 * Licensed under the License specified in the file LICENSE which is
 * included with the source code.
 * You may not use this file except in compliance with the License.
 *
 * 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 com.ctc.wstx.dtd;

/**
 * Abstract base class for classes that contain parts of a content
 * specification of an element defined in DTD. They are created
 * by {@link FullDTDReader} when parsing an DTD subset, and they
 * will be used for constructing actual validators for the element
 * content.
 */
public abstract class ContentSpec
{
    protected char mArity;

    /*
    ///////////////////////////////////////////////////
    // Life-cycle
    ///////////////////////////////////////////////////
     */

    public ContentSpec(char arity) {
        mArity = arity;
    }

    /*
    ///////////////////////////////////////////////////
    // Public API
    ///////////////////////////////////////////////////
     */

    public final char getArity() { return mArity; }

    public final void setArity(char c) { mArity = c; }

    public boolean isLeaf() { return false; }

    /**
     * Method called by input element stack to get validator for
     * this content specification, if this specification is simple
     * enough not to need full DFA-based validator.
     *
     * @return Simple content model validator, if one can be directly
     *   constructed, or null to indicate that a DFA needs to be
     *   created.
     */
    public abstract StructValidator getSimpleValidator();

    /**
     * Method called as the first part of DFA construction, if necessary;
     * will usually create simpler {@link ModelNode} instances that will
     * match definition this instance contains.
     */
    public abstract ModelNode rewrite();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy