]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix: Fixed the issue, where running indexerTask failed when saxon6.5.5 is in the...
authorKasun Gajasinghe <kasunbg@gmail.com>
Tue, 17 Aug 2010 08:49:24 +0000 (08:49 +0000)
committerKasun Gajasinghe <kasunbg@gmail.com>
Tue, 17 Aug 2010 08:49:24 +0000 (08:49 +0000)
--Kasun Gajasinghe

xsl/webhelp/indexer/lib/nw-cms.jar
xsl/webhelp/indexer/src/com/nexwave/nquindexer/IndexerTask.java
xsl/webhelp/indexer/src/com/nexwave/nquindexer/SaxDocFileParser.java
xsl/webhelp/indexer/src/com/nexwave/nquindexer/TesterIndexer.java

index 6102ebd9887a62e9a4ae50895fed9ed216753969..f2f4828816a318aec9629df0ac3f08ca60b92b6e 100755 (executable)
Binary files a/xsl/webhelp/indexer/lib/nw-cms.jar and b/xsl/webhelp/indexer/lib/nw-cms.jar differ
index 6b094ff3c7218ea4282ea6b703ea02a94b45b3a5..23009b88d3e82d3298a1052bf03c961f9e5b5baf 100755 (executable)
@@ -112,6 +112,19 @@ public class IndexerTask{
         */\r
 //     public void execute() throws BuildException {\r
        public void execute(){\r
+        try{\r
+            //Use Xerces as the parser. Does not support Saxon6.5.5 parser \r
+           System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");\r
+           System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");\r
+//           System.setProperty("org.xml.sax.driver", "com.icl.saxon.aelfred.SAXDriver");\r
+//           System.setProperty("javax.xml.parsers.SAXParserFactory", "com.icl.saxon.aelfred.SAXParserFactoryImpl");\r
+        } catch (SecurityException se){\r
+            System.out.println("[WARNING] Default parser is not set to Xerces. Make sure Saxon6.5.5 " +\r
+                    "is not in your CLASSPATH.");\r
+        } catch (Exception e){\r
+            System.out.println("[WARNING] Default parser is not set to Xerces. Make sure Saxon6.5.5 " +\r
+                    "is not in your CLASSPATH");\r
+        }\r
 \r
                ArrayList<DocFileInfo> filesDescription = null; // list of information about the topic files\r
                ArrayList<File> htmlFiles = null; // topic files listed in the given directory\r
index 04edc7819b55714aa5a3fb15cceecf2e9b823b1b..7a616c427c2baf83dda8a119ac23f38aaea7ca5d 100755 (executable)
@@ -44,7 +44,7 @@ public class SaxDocFileParser extends org.xml.sax.helpers.DefaultHandler {
         * Initializer\r
         */\r
        public int init(String inputDir){\r
-               return 0;       \r
+               return 0;\r
        }\r
 \r
        /**\r
@@ -65,9 +65,12 @@ public class SaxDocFileParser extends org.xml.sax.helpers.DefaultHandler {
        }\r
 \r
        public void parseDocument (File file) {\r
+//        System.out.println(System.getProperty("org.xml.sax.driver"));\r
+//        System.out.println(System.getProperty("javax.xml.parsers.SAXParserFactory"));\r
+        \r
                //get a factory\r
                javax.xml.parsers.SAXParserFactory spf = javax.xml.parsers.SAXParserFactory.newInstance();\r
-               \r
+\r
                spf.setValidating(false);\r
         addContent = false;\r
                divCount = 0;\r
@@ -77,7 +80,8 @@ public class SaxDocFileParser extends org.xml.sax.helpers.DefaultHandler {
                        // deactivate the validation\r
                        sp.getXMLReader().setFeature("http://xml.org/sax/features/external-general-entities", false);\r
                        sp.getXMLReader().setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false);\r
-                       //parse the file and also register this class for call backs\r
+\r
+            //parse the file and also register this class for call backs\r
                        System.out.println("Parsing: " + file);\r
                        \r
                        long start = System.currentTimeMillis();\r
@@ -92,16 +96,16 @@ public class SaxDocFileParser extends org.xml.sax.helpers.DefaultHandler {
                        //System.out.println("time = " + (finish - start) + " milliseconds");\r
                        \r
                }catch(org.xml.sax.SAXException se) {\r
-                       System.out.println("SaxException");\r
-                       se.printStackTrace();\r
-\r
+                       System.out.println("SaxException. You may need to include Xerces in your classpath. " +\r
+                    "See documentation for details");\r
+                       se.printStackTrace(); \r
                }catch(javax.xml.parsers.ParserConfigurationException pce) {\r
                        pce.printStackTrace();\r
                }catch (IOException ie) {\r
                        ie.printStackTrace();\r
                }\r
        }\r
-   //kasun: TODO remove indexing of css styles\r
+    \r
     private boolean addContent = false;\r
     private boolean addHeaderInfo = false;\r
     private boolean doNotIndex=false;\r
index b0e0257bb2ff7cc920fb41e1b1044a82897c3674..80060fc5b088469d676d822ea2db89a6fb12c875 100755 (executable)
@@ -9,7 +9,7 @@ import java.io.File;
  * \r
  * @author N. Quaine\r
  */\r
-public class TesterIndexer {\r
+    public class TesterIndexer {\r
        public static IndexerTask IT = null; \r
        /**\r
         * @param args\r