private void init()
 {
     //logger = new LoggingTool(this);
     bool success = false;
     // If JAXP is prefered (comes with Sun JVM 1.4.0 and higher)
     if (!success)
     {
         try
         {
             XmlSAXDocumentManager spf = XmlSAXDocumentManager.NewInstance();
             spf.NamespaceAllowed = true;
             XmlSAXDocumentManager saxParser = XmlSAXDocumentManager.CloneInstance(spf);
             //UPGRADE_TODO: Method 'javax.xml.parsers.SAXParser.getXMLReader' was converted to 'SupportClass.XmlSAXDocumentManager' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
             parser = saxParser;
             //logger.info("Using JAXP/SAX XML parser.");
             success = true;
         }
         catch (System.Exception exception)
         {
             //logger.warn("Could not instantiate JAXP/SAX XML reader!");
             //logger.debug(exception);
         }
     }
     // Aelfred is first alternative.
     if (!success)
     {
         try
         {
             //UPGRADE_TODO: Method 'java.lang.Class.newInstance' was converted to 'System.Activator.CreateInstance' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassnewInstance'"
             //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.loadClass' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
             //UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
             parser = new XmlSAXDocumentManager();//(XmlSAXDocumentManager)System.Activator.CreateInstance(this.GetType().getClassLoader().loadClass("gnu.xml.aelfred2.XmlReader"));
             //logger.info("Using Aelfred2 XML parser.");
             success = true;
         }
         catch (System.Exception e)
         {
             //logger.warn("Could not instantiate Aelfred2 XML reader!");
             //logger.debug(e);
         }
     }
     // Xerces is second alternative
     if (!success)
     {
         try
         {
             //UPGRADE_TODO: Method 'java.lang.Class.newInstance' was converted to 'System.Activator.CreateInstance' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangClassnewInstance'"
             //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.loadClass' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
             //UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
             parser = new XmlSAXDocumentManager();//(XmlSAXDocumentManager)System.Activator.CreateInstance(this.GetType().getClassLoader().loadClass("org.apache.xerces.parsers.SAXParser"));
             //logger.info("Using Xerces XML parser.");
             success = true;
         }
         catch (System.Exception e)
         {
             //logger.warn("Could not instantiate Xerces XML reader!");
             //logger.debug(e);
         }
     }
     if (!success)
     {
         //logger.error("Could not instantiate any XML parser!");
     }
 }
Example #2
0
 /// <summary>
 /// Returns a clone instance of 'XmlSAXDocumentManager'.
 /// </summary>
 /// <returns>A clone 'XmlSAXDocumentManager' instance.</returns>
 public static XmlSAXDocumentManager CloneInstance(XmlSAXDocumentManager instance)
 {
     XmlSAXDocumentManager temp = new XmlSAXDocumentManager();
     temp.NamespaceAllowed = instance.NamespaceAllowed;
     temp.isValidating = instance.isValidating;
     XmlSaxContentHandler contentHandler = instance.getContentHandler();
     if (contentHandler != null)
         temp.setContentHandler(contentHandler);
     XmlSaxErrorHandler errorHandler = instance.getErrorHandler();
     if (errorHandler != null)
         temp.setErrorHandler(errorHandler);
     temp.setFeature("http://xml.org/sax/features/namespaces", instance.getFeature("http://xml.org/sax/features/namespaces"));
     temp.setFeature("http://xml.org/sax/features/namespace-prefixes", instance.getFeature("http://xml.org/sax/features/namespace-prefixes"));
     temp.setFeature("http://xml.org/sax/features/validation", instance.getFeature("http://xml.org/sax/features/validation"));
     temp.setProperty("http://xml.org/sax/properties/lexical-handler", instance.getProperty("http://xml.org/sax/properties/lexical-handler"));
     temp.parserFileName = instance.parserFileName;
     return temp;
 }