Listing 1: StAX_Cursor.java

import javax.xml.stream.*;
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stax.*;

public class StAX_Cursor{

   public StAX_Cursor(){}
 
   public static void main(String[] args)
      {
      XMLInputFactory inputFactory=null;
      XMLOutputFactory outputFactory=null;
      XMLStreamReader streamReaderXSL=null;
      XMLStreamReader streamReaderXML=null;
      XMLStreamWriter streamWriter=null;
      Transformer transf=null;
                   
      //get an instance of the XMLInputFactory class
      inputFactory=XMLInputFactory.newInstance();
        
      //get an instance of the XMLOutputFactory class
      outputFactory=XMLOutputFactory.newInstance();
       
      //set three properties for the XMLInputFactory  
      inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities",Boolean.TRUE);
      inputFactory.setProperty("javax.xml.stream.isNamespaceAware",Boolean.TRUE);
      inputFactory.setProperty("javax.xml.stream.isReplacingEntityReferences",Boolean.TRUE);
                                    
      //get the XMLEventReader objects
      try{          
         streamReaderXSL=inputFactory.createXMLStreamReader("file:///C://Data_Local//article//",
                         new FileReader("C://Data_local//article//xslFile.xsl"));
         streamReaderXML=inputFactory.createXMLStreamReader("file:///C://Data_Local//article//",
                         new FileReader("C://Data_local//article//xmlFile.xml"));
         }catch(java.io.FileNotFoundException e)
            {System.out.println(e.getMessage());
         }catch(javax.xml.stream.XMLStreamException e)    
            {System.out.println(e.getMessage());}
                                                         
      //get a TransformerFactory object
      TransformerFactory transfFactory=TransformerFactory.newInstance();
         
      //define the Source object for the stylesheet
      Source XSL=new StAXSource(streamReaderXSL);
                  
      //get a Transformer object
      try{
         transf=transfFactory.newTransformer(XSL);
         }catch(javax.xml.transform.TransformerConfigurationException e)
            {System.out.println(e.getMessage());}
         
      //define the Source object for the XML document
      Source XML=new StAXSource(streamReaderXML);
         
      //create an XMLStreamWriter object
      try{
         streamWriter=outputFactory.createXMLStreamWriter
                      (new FileWriter("C://Data_local//article//members.html"));  
         }catch(java.io.IOException e)
            {System.out.println(e.getMessage());
         }catch(javax.xml.stream.XMLStreamException e)
            {System.out.println(e.getMessage());}
          
      //define the Result object
      Result XML_r=new StAXResult(streamWriter);

      //call the transform method
      try{
         transf.transform(XML,XML_r);
         }catch(javax.xml.transform.TransformerException e)
            {System.out.println(e.getMessage());}
      
      //clean up
      try{
         streamReaderXSL.close(); 
         streamReaderXML.close(); 
         streamWriter.close();
         }catch(javax.xml.stream.XMLStreamException e)
            {System.out.println(e.getMessage());}                       
      }
}

How to Add Java Applets to Your Site

New on the Java Boutique:

New Review:

Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling API boasts simplicity, ease-of-integration, a well-rounded feature set, and it's free!

New Applet:

Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA sequences into three useful formats.

Elsewhere on internet.com:

WebDeveloper Java
Lots of Java information on webdeveloper.com

WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.

ScriptSearch Java
Hundreds of free Java code files to download.

jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.