< prev index next >

src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/parser/XSOMParser.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 198     public XSSchemaSet getResult() throws SAXException {
 199         return context.getResult();
 200     }
 201 
 202     /**
 203      * Gets the set of {@link SchemaDocument} that represents
 204      * parsed documents so far.
 205      *
 206      * @return
 207      *      can be empty but never null.
 208      */
 209     public Set<SchemaDocument> getDocuments() {
 210         return new HashSet<SchemaDocument>(context.parsedDocuments.keySet());
 211     }
 212 
 213     public EntityResolver getEntityResolver() {
 214         return entityResolver;
 215     }
 216     /**
 217      * Set an entity resolver that is used to resolve things
 218      * like &lt;xsd:import> and &lt;xsd:include>.
 219      */
 220     public void setEntityResolver( EntityResolver resolver ) {
 221         this.entityResolver = resolver;
 222     }
 223     public ErrorHandler getErrorHandler() {
 224         return userErrorHandler;
 225     }
 226     /**
 227      * Set an error handler that receives all the errors encountered
 228      * during the parsing.
 229      */
 230     public void setErrorHandler(ErrorHandler errorHandler) {
 231         this.userErrorHandler = errorHandler;
 232     }
 233 
 234     /**
 235      * Sets the annotation parser.
 236      *
 237      * Annotation parser can be used to parse application-specific
 238      * annotations inside a schema.
 239      *
 240      * <p>
 241      * For each annotation, new instance of this class will be
 242      * created and used to parse &lt;xs:annotation>.
 243      */
 244     public void setAnnotationParser( final Class annParser ) {
 245         setAnnotationParser( new AnnotationParserFactory() {
 246             public AnnotationParser create() {
 247                 try {
 248                     return (AnnotationParser)annParser.newInstance();
 249                 } catch( InstantiationException e ) {
 250                     throw new InstantiationError(e.getMessage());
 251                 } catch( IllegalAccessException e ) {
 252                     throw new IllegalAccessError(e.getMessage());
 253                 }
 254             }
 255         });
 256     }
 257 
 258     /**
 259      * Sets the annotation parser factory.
 260      *
 261      * <p>
 262      * The specified factory will be used to create AnnotationParsers.
   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 198     public XSSchemaSet getResult() throws SAXException {
 199         return context.getResult();
 200     }
 201 
 202     /**
 203      * Gets the set of {@link SchemaDocument} that represents
 204      * parsed documents so far.
 205      *
 206      * @return
 207      *      can be empty but never null.
 208      */
 209     public Set<SchemaDocument> getDocuments() {
 210         return new HashSet<SchemaDocument>(context.parsedDocuments.keySet());
 211     }
 212 
 213     public EntityResolver getEntityResolver() {
 214         return entityResolver;
 215     }
 216     /**
 217      * Set an entity resolver that is used to resolve things
 218      * like {@code <xsd:import>} and {@code <xsd:include>}.
 219      */
 220     public void setEntityResolver( EntityResolver resolver ) {
 221         this.entityResolver = resolver;
 222     }
 223     public ErrorHandler getErrorHandler() {
 224         return userErrorHandler;
 225     }
 226     /**
 227      * Set an error handler that receives all the errors encountered
 228      * during the parsing.
 229      */
 230     public void setErrorHandler(ErrorHandler errorHandler) {
 231         this.userErrorHandler = errorHandler;
 232     }
 233 
 234     /**
 235      * Sets the annotation parser.
 236      *
 237      * Annotation parser can be used to parse application-specific
 238      * annotations inside a schema.
 239      *
 240      * <p>
 241      * For each annotation, new instance of this class will be
 242      * created and used to parse {@code <xs:annotation>}.
 243      */
 244     public void setAnnotationParser( final Class annParser ) {
 245         setAnnotationParser( new AnnotationParserFactory() {
 246             public AnnotationParser create() {
 247                 try {
 248                     return (AnnotationParser)annParser.newInstance();
 249                 } catch( InstantiationException e ) {
 250                     throw new InstantiationError(e.getMessage());
 251                 } catch( IllegalAccessException e ) {
 252                     throw new IllegalAccessError(e.getMessage());
 253                 }
 254             }
 255         });
 256     }
 257 
 258     /**
 259      * Sets the annotation parser factory.
 260      *
 261      * <p>
 262      * The specified factory will be used to create AnnotationParsers.
< prev index next >