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

com.sun.msv.relaxns.reader.relax.AnyOtherElementState Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: AnyOtherElementState.java,v 1.4 2003/06/09 20:37:37 kk122374 Exp $
 *
 * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the proprietary information of Sun Microsystems, Inc.  
 * Use is subject to license terms.
 * 
 */
package com.sun.msv.relaxns.reader.relax;

import org.xml.sax.Locator;

import com.sun.msv.grammar.Expression;
import com.sun.msv.reader.ExpressionWithoutChildState;
import com.sun.msv.relaxns.grammar.relax.AnyOtherElementExp;

/**
 * parses <anyOtherElement> state.
 * 
 * To create an expression that implements the semantics of anyOtherElement,
 * the entire grammar must be parsed first.
 * 
 * @author Kohsuke KAWAGUCHI
 */
public class AnyOtherElementState extends ExpressionWithoutChildState
{
    protected Expression makeExpression() {
        // when makeExpression is called, return only a skelton.
        // later, after the entire grammar is parsed, we'll provide
        // actual expression.
        
        String in = startTag.getAttribute("includeNamespace");
        String ex = startTag.getAttribute("excludeNamespace");

        if( in!=null && ex!=null ) {
            reader.reportError(
                new Locator[]{this.location},
                RELAXCoreIslandSchemaReader.ERR_CONFLICTING_ATTRIBUTES,
                new Object[]{"includeNamespace", "excludeNamespace"} );
            ex=null;
        }
        
        if( in==null && ex==null )
            ex="";    // this will correctly implement the semantics.
        
        final AnyOtherElementExp exp = new AnyOtherElementExp( this.location, in, ex );
        ((RELAXCoreIslandSchemaReader)reader).pendingAnyOtherElements.add(exp);
        return exp;
    }
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy