< prev index next >

src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/dtd/bindinfo/BindInfo.java

Print this page




 272 //
 273 //    Internal utility methods
 274 //
 275 //
 276 
 277 
 278     /** Gets the value from the option element. */
 279     private String getOption(String attName, String defaultValue) {
 280         Element opt = DOMUtil.getElement(dom,"options");
 281         if (opt != null) {
 282             String s = DOMUtil.getAttribute(opt,attName);
 283             if (s != null)
 284                 return s;
 285         }
 286         return defaultValue;
 287     }
 288 
 289     /**
 290      * Lazily parsed schema for the binding file.
 291      */
 292     private static SchemaCache bindingFileSchema = new SchemaCache("bindingfile.xsd", BindInfo.class);
 293 
 294     /**
 295      * Parses an InputSource into dom4j Document.
 296      * Returns null in case of an exception.
 297      */
 298     private static Document parse( Model model, InputSource is, ErrorReceiver receiver ) throws AbortException {
 299         try {
 300             ValidatorHandler validator = bindingFileSchema.newValidator();
 301 
 302             // set up the pipe line as :
 303             //              /-> extensionChecker -> validator
 304             //   parser-> -<
 305             //              \-> DOM builder
 306             SAXParserFactory pf = XmlFactory.createParserFactory(model.options.disableXmlSecurity);
 307             DocumentBuilderFactory domFactory = XmlFactory.createDocumentBuilderFactory(model.options.disableXmlSecurity);
 308             DOMBuilder builder = new DOMBuilder(domFactory);
 309 
 310             ErrorReceiverFilter controller = new ErrorReceiverFilter(receiver);
 311             validator.setErrorHandler(controller);
 312             XMLReader reader = pf.newSAXParser().getXMLReader();




 272 //
 273 //    Internal utility methods
 274 //
 275 //
 276 
 277 
 278     /** Gets the value from the option element. */
 279     private String getOption(String attName, String defaultValue) {
 280         Element opt = DOMUtil.getElement(dom,"options");
 281         if (opt != null) {
 282             String s = DOMUtil.getAttribute(opt,attName);
 283             if (s != null)
 284                 return s;
 285         }
 286         return defaultValue;
 287     }
 288 
 289     /**
 290      * Lazily parsed schema for the binding file.
 291      */
 292     private static final SchemaCache bindingFileSchema = new SchemaCache("bindingfile.xsd", BindInfo.class, true);
 293 
 294     /**
 295      * Parses an InputSource into dom4j Document.
 296      * Returns null in case of an exception.
 297      */
 298     private static Document parse( Model model, InputSource is, ErrorReceiver receiver ) throws AbortException {
 299         try {
 300             ValidatorHandler validator = bindingFileSchema.newValidator();
 301 
 302             // set up the pipe line as :
 303             //              /-> extensionChecker -> validator
 304             //   parser-> -<
 305             //              \-> DOM builder
 306             SAXParserFactory pf = XmlFactory.createParserFactory(model.options.disableXmlSecurity);
 307             DocumentBuilderFactory domFactory = XmlFactory.createDocumentBuilderFactory(model.options.disableXmlSecurity);
 308             DOMBuilder builder = new DOMBuilder(domFactory);
 309 
 310             ErrorReceiverFilter controller = new ErrorReceiverFilter(receiver);
 311             validator.setErrorHandler(controller);
 312             XMLReader reader = pf.newSAXParser().getXMLReader();


< prev index next >