Package com.sun.msv.reader.relax.core

Source Code of com.sun.msv.reader.relax.core.HedgeRuleState

/*
* @(#)$Id: HedgeRuleState.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.relax.core;

import com.sun.msv.grammar.Expression;
import com.sun.msv.grammar.relax.HedgeRules;
import com.sun.msv.reader.relax.HedgeRuleBaseState;

/**
* parses <hedgeRule> element
*
* this class is used as the base class of TopLevelState
*
* @author <a href="mailto:kohsuke.kawaguchi@eng.sun.com">Kohsuke KAWAGUCHI</a>
*/
public class HedgeRuleState extends HedgeRuleBaseState
{
    protected void endSelf( Expression contentModel )
    {
        final String label = startTag.getAttribute("label");
        if( label==null )
        {
            reader.reportError( RELAXCoreReader.ERR_MISSING_ATTRIBUTE, "hedgeRule", "label" );
            return;    // recover by ignoring this hedgeRule
        }
       
        final RELAXCoreReader reader = (RELAXCoreReader)this.reader;
       
        HedgeRules hr = reader.module.hedgeRules.getOrCreate(label);
        reader.setDeclaredLocationOf(hr); // remember where this hedgeRule is defined.
        hr.addHedge(contentModel,reader.pool);
    }
}
TOP

Related Classes of com.sun.msv.reader.relax.core.HedgeRuleState

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.