• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

help on newInstance() method

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi:
The following two line code was from xml4j-3-2-0/samples/sax/sax2count.java (from IBM site)
String parserName="org.apache.xerces.parsers.SAXParser"
XMLReader parser = (XMLReader)Class.forName(parserName).newInstance();///??
Class.forName(parserName) return object of org.apache.xerces.parsers.SAXParser
I do not see any newInstance() method belong to org.apache.xerces.parsers.SAXParser ot XMLReader///!!
the only two newInstance() methods can be found at following:
newInstance() - Static method in class javax.xml.parsers.SAXParserFactory
Obtain a new instance of a SAXParserFactory.
newSAXParser() - Method in class javax.xml.parsers.SAXParserFactory
Creates a new instance of a SAXParser using the currently configured factory parameters.
class javax.xml.parsers.SAXParserFactory was directly extended from java.lang.Object
Somebody please help me, how could newInstance() be called in statement of XMLReader parser = (XMLReader)Class.forName(parserName).newInstance()
Thank you for help!
Tom Gong
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic