commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harvinder Singh" <harvinder_si...@mindtree.com>
Subject RE: Help Required - In Debugging Digester code
Date Wed, 04 Sep 2002 12:33:27 GMT
I found the solution to my problem and I think the information I provided in
my earlier email was not sufficient to debug it. In one of the classes I was
using ArrayList but I forgot to initialize it and got the exception trace I
mentioned earlier. 

I would like to know some pointers to debug such problems having the
exception trace in hand.

Thanks.

-----Original Message-----
From: Harvinder Singh 
Sent: Wednesday, September 04, 2002 5:40 PM
To: commons-dev@jakarta.apache.org
Subject: Help Required - In Debugging Digester code


Hi, 
I am trying to parse following XML using Digester But getting an Exception
trace. Could anybody tell me how do I debug the code?

====================================
<?xml version="1.0"?>
<services>
<service name="Request" home_page_action="/action/Request/edit"> 
 <title> 	
	<element order="2">
		<key>Name</key>
		<size>10</size>
		<display>Name</display>
		<display-type>3</display-type>
		<action-link></action-link>	
	</element>
	<element order="3">
		<key> Description </key>
		<size> 20 </size>
		<display> Description </display>
		<display-type>3</display-type>
		<action-link></action-link>	
	</element>
	<element order="7">
		<key>Create</key>
		<size> 10 </size>
		<display></display>
		<display-type>2</display-type>
		<action-link></action-link>	
	    <image>
		<identifier>0</identifier>
		<url>ImageURL0</url>
		<tip>Tip0</tip>
		<action-link>/myApp/create</action-link>		
		<size>10</size>		
	    </image>    
	    <image>    
		<identifier>1</identifier>
		<url>Image1</url>
		<tip>Tip1</tip>
		<action-link></action-link>		
		<size>10</size>		
	    </image>			
	</element>
	<element order="8">
		<key>Help</key>
		<size> 5 </size>
		<display></display>
		<display-type>2</display-type>
		<action-link></action-link>	
	</element>	
</title>
<body>	
		<element order="2">
			<key>Name</key>
			<size> 10 </size>
			<display></display>
			<display-type>1</display-type>
			<action-link>/action/edit</action-link>	
		</element>
		<element order="3">
			<key>Description</key>
			<size> 20 </size>
			<display></display>
			<display-type>0</display-type>
			<action-link></action-link>	
		</element>
		<element order="7">
			<key>EDIT</key>
			<size> 10 </size>
			<display></display>
			<display-type>2</display-type>
			<action-link>/myApp/edit</action-link>	
		</element>				
		<element order="9">
			<key>vicky</key>
			<size> 10 </size>
			<display></display>
			<display-type>2</display-type>
			<action-link>/myApp/edit</action-link>	
		</element>	
		<element order="10">
			<key>Harvinder</key>
			<size> 10 </size>
			<display></display>
			<display-type>2</display-type>
			<action-link>/myApp/edit</action-link>	
		</element>			
</body>
</service>
</services>
====================================

The Eception trace is :
=====================================
The exception trace is :-

java.lang.reflect.InvocationTargetException
        at
org.apache.commons.digester.Digester.createSAXException(Digester.java
:2033)
        at
org.apache.commons.digester.Digester.createSAXException(Digester.java
:2053)
        at org.apache.commons.digester.Digester.endElement(Digester.java:833)
        at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
        at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLVa
lidator.java:1337)
        at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.disp
atch(XMLDocumentScanner.java:1256)
        at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java:381)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
        at org.apache.commons.digester.Digester.parse(Digester.java:1302)
        at
org.apache.commons.digester.rss.MetaDataDigester.parse(MetaDataDigest
er.java:141)
        at
org.apache.commons.digester.rss.MetaDataDigester.main(MetaDataDigeste
r.java:269)


=====================================

The java code is :
=====================================

protected void configure() {

        if (configured) {
            return;
        }

        // FIXME - validate the "version" attribute of the rss element?

        // Add the rules for the Channel object
        addObjectCreate("services/service", serviceClass);

        // Add the rules for the Title object
        addObjectCreate("services/service/title/element", titleClass);
        addSetNext("services/service/title/element", "addTitleMetaData",
                "com.ispheres.zen.web.designcenter.framework.TitleMetaData");
        addCallMethod("services/service/title/element", "setOrder", 1,
        		new Class[]{ Integer.TYPE });
        addCallParam("services/service/title/element",0,"order");
        addCallMethod("services/service/title/element/key", "setKey", 0);
        addCallMethod("services/service/title/element/size", "setSize", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/title/element/display", "setDisplay",
0);
        addCallMethod("services/service/title/element/display-type",
"setDisplayType", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/title/element/action-link",
"setActionLink", 0);

		// Add the rules for the Image object
		addObjectCreate("services/service/title/element/image",
imageClass);
		addSetProperties("services/service/title/element/image");
        addSetNext("services/service/title/element/image", "addImage",
                "com.ispheres.zen.web.designcenter.framework.ImageObject");
        addCallMethod("services/service/title/element/image/identifier",
"setImageIdentifier", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/title/element/image/url",
"setImageUrl", 0);
        addCallMethod("services/service/title/element/image/tip",
"setImageTip", 0);
        addCallMethod("services/service/title/element/image/action-link",
"setImageActionLink", 0);
 		addCallMethod("services/service/title/element/image/size",
"setImageSize", 0,
				new Class[]{ Integer.TYPE });


        // Add the rules for the body object
        addObjectCreate("services/service/body/element", bodyClass);
        addSetNext("services/service/body/element", "addBodyMetaData",
                "com.ispheres.zen.web.designcenter.framework.BodyMetaData");
        addCallMethod("services/service/body/element", "setOrder", 1,
        		new Class[]{ Integer.TYPE });
        addCallParam("services/service/body/element",0,"order");
        addCallMethod("services/service/body/element/key", "setKey", 0);
        addCallMethod("services/service/body/element/size", "setSize", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/body/element/display", "setDisplay",
0);
        addCallMethod("services/service/body/element/display-type",
"setDisplayType", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/body/element/action-link",
"setActionLink", 0);

		// Add the rules for the Image object
/*		addObjectCreate("services/service/body/element/image",
imageClass);
        addSetNext("services/service/body/element/image", "addImageData",
                "com.ispheres.zen.web.designcenter.framework.ImageObject");
        addCallMethod("services/service/body/element/image/identifier",
"setImageIdentifier", 0,
        		new Class[]{ Integer.TYPE });
        addCallMethod("services/service/body/element/image/url",
"setImageUrl", 0);
        addCallMethod("services/service/body/element/image/tip",
"setImageTip", 0);
        addCallMethod("services/service/body/element/image/action-link",
"setImageActionLink", 0);
        addCallMethod("services/service/body/element/image/size",
"setImageSize", 0,
				new Class[]{ Integer.TYPE });
*/
        // Mark this digester as having been configured
        configured = true;

    }

=====================================

If I remove <image> tag code works fine. Thansks.

Regards,
Harvinder


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message