summaryrefslogtreecommitdiff
path: root/Build/source/texk/tex4htk/java/JsmlFilter.java
blob: 16cbf4fbad46fc2e27bc3bd7e55f50505c64be1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package tex4ht;
import org.xml.sax.helpers.*;
import org.xml.sax.*;
import java.io.PrintWriter;

public class JsmlFilter extends XMLFilterImpl {
     PrintWriter out = null;
   public JsmlFilter( PrintWriter out, PrintWriter log, boolean trace ){
     this.out = out;
   }
   public void startElement(String ns, String sName,
                           String qName, Attributes attr) {
      try{
        if(    qName.equals( "p" )
|| qName.equals( "h2" )
|| qName.equals( "h3" )
|| qName.equals( "h4" )
|| qName.equals( "ul" )
|| qName.equals( "ol" )
|| qName.equals( "li" )
|| qName.equals( "dd" )
|| qName.equals( "dl" )
 ){
          Attributes att = new AttributesImpl();
          super.startElement(ns, "PARA", "PARA", att);
        }
        super.startElement(ns, sName, qName, attr);
      } catch( Exception e ){
        System.out.println( "--- JsmlFilter Error 1 --- " + e);
   }  }
   public void endElement(String ns, String sName, String qName){
      try{
        super.endElement(ns, sName, qName);
        if(    qName.equals( "p" )
|| qName.equals( "h2" )
|| qName.equals( "h3" )
|| qName.equals( "h4" )
|| qName.equals( "ul" )
|| qName.equals( "ol" )
|| qName.equals( "li" )
|| qName.equals( "dd" )
|| qName.equals( "dl" )
 ){
             super.endElement(ns, "PARA", "PARA");
        }
      } catch( Exception e ){
        System.out.println( "--- JsmlFilter Error 2 --- " + e);
}  }  }