commons-user mailing list archives

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

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:response>
	<a:href>https://webmail.myorg.org/exchange/my.name/calendar/mymeeting.EML</a:href>
	<a:propstat>
		<a:status>HTTP/1.1 200 OK</a:status>
		<a:prop>
			<d:to>"Some Name" &lt;some.name@myorg.org&gt;, =?iso-8859-1</d:to>
			<e:subject>Meeting</e:subject>
			<f:dtstart b:dt="dateTime.tz">2004-12-13T12:30:00.000Z</f:dtstart>
			<f:dtend b:dt="dateTime.tz">2004-12-13T14:00:00.000Z</f:dtend>
			<f:location>Meeting room 4</f:location>
		</a:prop>
	</a:propstat>
	<a:propstat>
		<a:status>HTTP/1.1 404 Resource Not Found</a:status>
		<a:prop><e:textdescription/></a:prop>
	</a:propstat>
</a:response>

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"/>
</pattern>

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

/Kax


---------------------------------------------------------------------
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