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

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

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: InterfaceStateEx.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 com.sun.msv.grammar.relax.RELAXModule;
import com.sun.msv.reader.ChildlessState;
import com.sun.msv.reader.State;
import com.sun.msv.reader.relax.core.InterfaceState;
import com.sun.msv.util.StartTagInfo;

/**
 * parses <interface> element and <div> in interface.
 * 
 * @author Kohsuke KAWAGUCHI
 */
class InterfaceStateEx extends InterfaceState
{
    protected State createChildState( StartTagInfo tag )
    {
        RELAXCoreIslandSchemaReader reader = (RELAXCoreIslandSchemaReader)this.reader;
        if(!tag.namespaceURI.equals(RELAXCoreIslandSchemaReader.RELAXCoreNamespace))    return null;
        
        if(tag.localName.equals("div"))        return new InterfaceStateEx();
        
        
        RELAXModule module = reader.getModule();
        
        if(tag.localName.equals("export"))
        {
            final String role = tag.getAttribute("role");
            
            if(role!=null)
            {
                module.attPools.getOrCreate(role).exported = true;
                return new ChildlessState();
            }
            // base class may process this element.
        }
        if(tag.localName.equals("hedgeExport"))
        {
            final String label = tag.getAttribute("label");
            if(label==null)
                reader.reportError(RELAXCoreIslandSchemaReader.ERR_MISSING_ATTRIBUTE,"hedgeExport","label");
                // recover by ignoring this hedgeExport
            else
                module.hedgeRules.getOrCreate(label).exported = true;
            
            return new ChildlessState();
        }
        
        return super.createChildState(tag);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy