src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/tools/ResolvingParser.java

Print this page

        

@@ -1,19 +1,13 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
- */
-// ResolvingParser.java - An interface for reading catalog files
-
-/*
- * Copyright 2001-2004 The Apache Software Foundation or its licensors,
- * as applicable.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

@@ -65,21 +59,16 @@
  *
  * @version 1.0
  */
 public class ResolvingParser
   implements Parser, DTDHandler, DocumentHandler, EntityResolver {
-  /** Make the parser Namespace aware? */
-  public static boolean namespaceAware = true;
 
-  /** Make the parser validating? */
-  public static boolean validating = false;
-
   /** Suppress explanatory message?
    *
    * @see #parse(InputSource)
    */
-  public static boolean suppressExplanation = false;
+  private static final boolean suppressExplanation = false;
 
   /** The underlying parser. */
   private SAXParser saxParser = null;
 
   /** The underlying reader. */

@@ -101,13 +90,10 @@
   private CatalogResolver piCatalogResolver = null;
 
   /** Are we in the prolog? Is an oasis-xml-catalog PI valid now? */
   private boolean allowXMLCatalogPI = false;
 
-  /** Has an oasis-xml-catalog PI been seen? */
-  private boolean oasisXMLCatalogPI = false;
-
   /** The base URI of the input document, if known. */
   private URL baseURL = null;
 
   /** Constructor. */
   public ResolvingParser() {

@@ -123,12 +109,12 @@
   /** Initialize the parser. */
   private void initParser() {
     catalogResolver = new CatalogResolver(catalogManager);
     SAXParserFactory spf = catalogManager.useServicesMechanism() ?
                     SAXParserFactory.newInstance() : new SAXParserFactoryImpl();
-    spf.setNamespaceAware(namespaceAware);
-    spf.setValidating(validating);
+    spf.setNamespaceAware(true);
+    spf.setValidating(false);
 
     try {
       saxParser = spf.newSAXParser();
       parser = saxParser.getParser();
       documentHandler = null;

@@ -287,11 +273,10 @@
           catalogManager.debug.message(4,"oasis-xml-catalog PI", pidata);
 
           if (catalog != null) {
             try {
               catalogManager.debug.message(4,"oasis-xml-catalog", catalog.toString());
-              oasisXMLCatalogPI = true;
 
               if (piCatalogResolver == null) {
                 piCatalogResolver = new CatalogResolver(true);
               }
 

@@ -394,11 +379,14 @@
         InputStream iStream = url.openStream();
         iSource.setByteStream(iStream);
 
         return iSource;
       } catch (Exception e) {
-        catalogManager.debug.message(1, "Failed to create InputSource", resolved);
+        catalogManager.debug.message(1,
+                                     "Failed to create InputSource ("
+                                     + e.toString()
+                                     + ")", resolved);
         return null;
       }
     } else {
       return null;
     }