Michael, Thanks again. I was slightly misled by the names ending with 'Configuration' in that I thought they should somehow be used to configure a parser rather than to act as a parser themselves. In any event, I think I've finally got things straightened out. Just to make sure I'm not confused: if I'm using the xni PullParserConfiguration I have to use the xni.XMLDocumentHandler class in order to get my callbacks rather than the normal ContentHandler. Is that true or is there some way to use ContentHandler in conjunction with a pull parser? Thanks again for your help.
-jason --- Michael Glavassevich <[EMAIL PROTECTED]> wrote: > Jason, > > There's no magic service for obtaining > XMLPullParserConfigurations. The > default parser configuration: > org.apache.xerces.parsers.XIncludeAwareParserConfiguration > implements > org.apache.xerces.xni.parser.XMLPullParserConfiguration. > It has public > constructors. You can create it directly. The other > available parser > configurations are listed here [1]. > > Thanks. > > [1] > http://xml.apache.org/xerces2-j/faq-xni.html#faq-3 > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [EMAIL PROTECTED] > E-mail: [EMAIL PROTECTED] > > Jason <[EMAIL PROTECTED]> wrote on 10/27/2005 > 04:49:46 PM: > > > Hello, > > > > I'm trying to use the methods in the interface > > > org.apache.xerces.xni.parser.XMLPullParserConfiguration > > and I can't figure out how to create an instance > of a > > parser which implements it. I've made two > attempts - > > the first is to run this code: > > > > //Begin Code > > public static void main(String[] args) throws > > Exception > > { > > XMLParserConfiguration parserConfig = null; > > > > // create parser configuration > > try > > { > > parserConfig = > > > > > (XMLParserConfiguration)ObjectFactory.newInstance("org.apache. > > xerces.xni.parser.XMLPullParserConfiguration", > > > ObjectFactory.findClassLoader(), > > true); > > > > } > > catch (Exception e) > > { > > System.err.println("error: Unable to > instantiate > > parser configuration > > > org.apache.xerces.xni.parser.XMLPullParserConfiguration"); > > } > > > > // XMLDocumentParser parser = new > > XMLDocumentParser(parserConfig); > > //End Code > > > > Getting this code to compile involved copying > > ObjectFactory.java and SecuritySupport.java from > the > > samples/xni directory and building them along with > my > > test code. When I run the class I get this error: > > > > Exception in thread "main" > > ObjectFactory$ConfigurationError: Provider > > > org.apache.xerces.xni.parser.XMLPullParserConfiguration > > could not be instantiated: > > java.lang.InstantiationException: > > > org.apache.xerces.xni.parser.XMLPullParserConfiguration > > at > > ObjectFactory.newInstance(ObjectFactory.java:346) > > at > PullParserTest.main(PullParserTest.java:35) > > > > I also tried launching the VM like so: > > > > java > > > -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache. > > xerces.xni.parser.XMLPullParserConfiguration > > PullParserTest ADMAdapterOutput.xml > > > > but that didn't help. I've poked around the > > documentation quite a bit but I'm still in the > dark. > > Am I making this harder than need be? Can anyone > > provide me with a bit of code to create a > PullParser > > instance? Thanks in advance. > > > > -jason > > > > > > > > > > > > __________________________________ > > Yahoo! FareChase: Search multiple travel sites in > one click. > > http://farechase.yahoo.com > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
