commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Grey" <gre...@hotmail.com>
Subject Re: [digester] Multiple Digester Instances
Date Tue, 14 Oct 2003 20:45:13 GMT
Actually I resolved the problem by creating a "cache" of digester objects in 
a Vector before the application starts. Then I pull those objects off one by 
one as I need them. It seems that if I intialize a new Digester object after 
parsing has started it begins to create the "null pointers" which occur in 
various places. I am using the same rules object I created in the beginning 
because all of the XML files are the same, I just hoped to split them into 
multiple files for sake of coherence in our application. Could that be the 
problem? Here is an example of one of the "null pointers":

[EDS]  - Problems parsing main config file: : 
com.circuitcity.eds.exceptions.XmlParseException: com. 
circuitcity.eds.exceptions.XmlParseException: 
com.circuitcity.eds.exceptions.XmlParseException: java 
.lang.NullPointerException
        at 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
        at 
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
        at 
org.apache.commons.digester.Digester.endElement(Digester.java:1061)
        at 
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
        at 
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
        at 
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1809)
        at 
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScan
ner.java:1182)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
        at org.apache.commons.digester.Digester.parse(Digester.java:1567)

Thanks for your support.
-Robert Grey

>From: Simon Kitching <simon@ecnetwork.co.nz>
>Reply-To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
>To: Jakarta Commons Users List <commons-user@jakarta.apache.org>
>Subject: Re: [digester] Multiple Digester Instances
>Date: Wed, 15 Oct 2003 09:25:27 +1300
>
>Hi Robert,
>
>The "xmlrules" code currently does this sort of thing, so you may wish
>to look there for inspiration.
>
>It would also help if you included the stack trace for your "null
>pointer" problems.
>
>One thing I notice in your code snippet below: where does the "rules"
>object you are passing to your new Digester instance come from? If it is
>the value returned by digester.getRules(), then this may be the cause of
>the problem; I doubt that the same Rules object can be used in multiple
>Digester instances.
>
>Regards,
>
>Simon
>
>On Wed, 2003-10-15 at 09:10, Robert Grey wrote:
> > Currently I am using digester recursively,  I have an object that will
> > create a new instance of digester when it is called from a rule in a
> > previous digester instance. I continually get null pointers when I try 
>to do
> > this with this code:
> >
> > public void parseMainConfigFile(InputStream stream) throws 
>GeneralException
> > {
> >     // now that plugins are configured, start the parsing process
> >     try {
> >         //return (ParseMainXml) digester.parse(stream);
> >         Digester newDigester = new Digester();
> >         newDigester.setValidating(false);
> >         newDigester.addObjectCreate(ROOTNODE, ParseMainXml.class);
> >         newDigester.setRules(rules);
> >         newDigester.parse(stream);
> >      } catch (Exception e) {
> >         throw new XmlParseException(e);
> >      }
> > }
> >
> > This method is used to create the original parser and to parse documents
> > called from that original parser. Is there any way to do this properly?
> > Thanks for any advice...
> > -Robert Grey
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

_________________________________________________________________
Never get a busy signal because you are always connected  with high-speed 
Internet access. Click here to comparison-shop providers.  
https://broadband.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message