This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Java code example of transforming via SAX with JAXP1.1?


Wasn't the original request about SAX parsing??

(for help on what all this means visit http://www.saxproject.org )

import java.io.*;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import com.icl.saxon.*;

public class ASaxParser extends DefaultHandler {
   
    private String currentElement_ = null;
    private StringBuffer currentContent_ = null;
    private Attributes currentAtts_ = null;
    
    public void getFile(String path) {
        SAXParserFactory factory = SAXParserFactory.newInstance();
        try {
            SAXParser saxParser = factory.newSAXParser();
            saxParser.parse( new File(path), this );

        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    
    public void startDocument()
    {
    }

    public void endDocument()
    {
    }
  
    public void startElement(String uri, String name,String qName,
Attributes atts)
    {
    }

    public void endElement(String uri, String name, String qName) 
    {
    }
 }

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.350 / Virus Database: 196 - Release Date: 17/04/2002
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]