commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kax <>
Subject [Digester] Problems
Date Mon, 20 Dec 2004 10:39:48 GMT

The problem I have is not really with Digester, the problem is with the xml I have to parse.
I thought using Digester was a good approach and I still think it is but I need some help
to solve a problem I have.

I receive xml which looks like this:

		<a:status>HTTP/1.1 200 OK</a:status>
			<d:to>"Some Name" &lt;;, =?iso-8859-1</d:to>
			<f:dtstart b:dt="">2004-12-13T12:30:00.000Z</f:dtstart>
			<f:dtend b:dt="">2004-12-13T14:00:00.000Z</f:dtend>
			<f:location>Meeting room 4</f:location>
		<a:status>HTTP/1.1 404 Resource Not Found</a:status>

This is a response to a propstat question via webdav to Microsoft Exchange. What I want to
do is to create a new CalendarAppointment object everytime I run in to a <a:propstat>
element. But the problem is that if a property of the appointment is empty, like the <e:textdescription/>
above, a propstat element is included in the response and at this <a:propstat> element
I don't want to create another CalendarAppointment object. And I don't want to try setting
the properties of the element and I don't want to call the addAppointment method, see example
xml rule file below:

<pattern value="*/a:prop">
<object-create-rule classname="myClass"/>
<call-method-rule pattern="e:subject" methodname="setSubject" paramcount="0"/>
		<call-method-rule pattern="e:textdescription" methodname="setText" paramcount="0"/>
		<call-method-rule pattern="f:location" methodname="setLocation" paramcount="0"/>
<set-next-rule methodname="addAppointment"/>

A way to solve this would be to check the content of the <a:status> element. If it contains
200 everything is ok and the object can be created, the properties can be set and the addAppoinntment
method could be called, otherwise not. Can I acheive this behaviour with Digester?

Thanks in advance


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message