1 /* Copyright 2004 The Apache Software Foundation 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package org.apache.xmlbeans; 17 18 import javax.xml.namespace.QName; 19 20 import org.xml.sax.ContentHandler; 21 import org.xml.sax.ext.LexicalHandler; 22 23 /** 24 * A holder for a SAX {@link ContentHandler} and {@link LexicalHandler} that are 25 * capable of loading an {@link XmlObject} instance. Once all the SAX events are pushed 26 * to the handlers, call {@link #getObject()} to get the loaded XmlObject. 27 * 28 * @see XmlObject.Factory#newXmlSaxHandler 29 * @see SchemaTypeLoader#newXmlSaxHandler 30 */ 31 public interface XmlSaxHandler 32 { 33 /** 34 * The ContentHandler expecting SAX content events. 35 * @see ContentHandler 36 */ 37 ContentHandler getContentHandler ( ); 38 39 /** 40 * The LexicalHandler expecting SAX lexical events. 41 * @see LexicalHandler 42 */ 43 LexicalHandler getLexicalHandler ( ); 44 45 /** 46 * Insert a bookmark before the token associated with the last SAX event. 47 */ 48 void bookmarkLastEvent ( XmlCursor.XmlBookmark mark ); 49 50 /** 51 * Insert a bookmark before the attr token associated with the last SAX element event. 52 */ 53 void bookmarkLastAttr ( QName attrName, XmlCursor.XmlBookmark mark ); 54 55 /** Returns the loaded XmlObject after all the SAX events have been finished */ 56 XmlObject getObject ( ) throws XmlException; 57 }