[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Java - XMLReader and SAX Filters

  • To: xml-dev@l...
  • Subject: Re: Java - XMLReader and SAX Filters
  • From: "Filipe Correia" <filipe.correia@p...>
  • Date: Fri, 12 Jul 2002 15:48:29 +0100
  • Cc: "Girish Patil" <girish_patil@f...>
  • In-reply-to: <200206251507060572.0157C48D@m...>
  • References: <200206251507060572.0157C48D@m...>

java xmlreader

Hi,

Girish Patil wrote:
>Hi,
>I am having a similar problem, I am using a custom class that extends
>XMLReader interface to generate the SAX events which I feed into xslt
>processor. It seems to work if I do it in 2 steps, first generate my xml
>files and then use this static xml file and apply transformation to it.
>But if I pass the sax events directly to the processor , it seems to
>ignore my xsl file and just print out the list of all text node.
>I was searching through the list and found You to have similar problem
>with xalan. Did u by any chance figure out why this happens, or what is
>the code solution for this.
>
>Any help would be greatly appreciated :) I am kind of stuck out here:(
>
>thanks
>-Girish



   I couldn't figure it out and gave up on that solution. But what I was asking in my thread had to do with reading the xml from a file using an XMLReader. What you're doing is not quite the same... you're using a class that extends XMLReader to generate the events...

However I'm also using the approach you mention (generating the events...) but I'm extending XMLFilterImpl and not XMLReader.
Using this approach I'm currently having good results and had never got that problem...
Here's a sample of the code I'm using:


import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.io.*;

public class ExtendedReader extends XMLFilterImpl{

	public ExtendedReader(){
	}

	public void parse(String dummy){

		try {

			startDocument();
			startElement("", "element", "element", new AttributesImpl());
			endElement("", "elements", "elements");
			endDocument();

		} catch (Exception e) {
	     System.err.println("Error:" + e.getMessage());
		}

	}
}


  Cheers,

        Filipe




PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.