Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2
|
BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2
This is the forum to discuss the Wrox book Beginning XML, 4th Edition by David Hunter, Jeff Rafter, Joe Fawcett, Eric van der Vlist, Danny Ayers, Jon Duckett, Andrew Watt, Linda McKinnon; ISBN: 9780470114872
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2009, 10:11 PM
Registered User
 
Join Date: Nov 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Another (simpler) Java SAX parser solution

Hi,

according to page 489 dear authors wrote:

Code:
XMLReader reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
reader.setContentHandler(this);
reader.parse(filename);
I don't get why authors wrote imports (two Java classes):

Code:
import javax.xml.parsers.SAXParserFactory;
import javax.xml.parsers.SAXParser;
and then did not use them, confusing thing for me. Never mind.

I think this can be done simpler without outside SAX Parser (xerces) configuration (with CLASSPATH variable settings) by this code (instead of above):

Code:
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser reader = factory.newSAXParser();
reader.parse(filename, this);
Of course above imports getting necessary now.

Kind regards





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use sax parser pavanntcs XSLT 3 September 13th, 2006 02:02 AM
How to parse xml using SAX Parser?? priyatowin XSLT 2 September 8th, 2006 02:56 AM
problem with validating sax parser vijay3000 XML 1 April 18th, 2006 10:15 AM
SAX Parser Error dpan168 XML 0 October 26th, 2004 04:53 PM
java.lang.NoClassDefFoundError: org/xml/sax/XMLRea kcheung XSLT 0 August 8th, 2003 08:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.