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

msv.msv.src.com.sun.msv.reader.xmlschema.AnyAttributeState Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: AnyAttributeState.java 1566 2003-06-09 20:37:49Z kk122374 $
 *
 * 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.reader.xmlschema;

import com.sun.msv.grammar.Expression;
import com.sun.msv.grammar.NameClass;
import com.sun.msv.grammar.ReferenceExp;
import com.sun.msv.grammar.xmlschema.AttributeDeclExp;
import com.sun.msv.grammar.xmlschema.AttributeWildcard;
import com.sun.msv.grammar.xmlschema.XMLSchemaSchema;

/**
 * used to parse <anyAttribute > element.
 * 
 * @author Kohsuke KAWAGUCHI
 */
public class AnyAttributeState extends AnyState {

    protected Expression createExpression( final String namespace, final String process ) {
        final XMLSchemaReader reader = (XMLSchemaReader)this.reader;
        final XMLSchemaSchema currentSchema = reader.currentSchema;

        int mode;
        
        if(process.equals("skip"))        mode = AttributeWildcard.SKIP;
        else
        if(process.equals("lax"))        mode = AttributeWildcard.LAX;
        else
        if(process.equals("strict"))    mode = AttributeWildcard.STRICT;
        else {
            reader.reportError( XMLSchemaReader.ERR_BAD_ATTRIBUTE_VALUE, "processContents", process );
            mode = AttributeWildcard.SKIP;
        }
        
        ((AnyAttributeOwner)parentState).setAttributeWildcard(
            new AttributeWildcard( getNameClass(namespace,currentSchema), mode ) );
        
        return Expression.epsilon;
    }

    protected NameClass getNameClassFrom( ReferenceExp exp ) {
        return ((AttributeDeclExp)exp).self.nameClass;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy