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

com.sun.msv.reader.IgnoreState Maven / Gradle / Ivy

There is a newer version: 2.2.5.1
Show newest version
/*
 * @(#)$Id: IgnoreState.java,v 1.7 2003/06/09 20:37:23 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.reader;

import org.xml.sax.Attributes;

/**
 * state that ignores the entire subtree.
 * 
 * @author Kohsuke KAWAGUCHI
 */
public class IgnoreState extends State {
    // the parent state receives startElement event for this state.
    // so we have to start from one, rather than zero.
    private int depth = 1;

    public final void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
        depth++;
    }
    
    public final void endElement(String namespaceURI, String localName, String qName) {
        depth--;
        if (depth == 0)
            reader.popState();
    }
    
    public final void endDocument() {
        // assert depth==0
        reader.popState();
    }
    
    public void characters(char[] buffer, int from, int len) {
        // ignore literals
    }

}
    
    




© 2015 - 2025 Weber Informatics LLC | Privacy Policy