commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lafredo, Stephen" <stephen_lafr...@merck.com>
Subject RE: defining rules in XML
Date Fri, 18 Apr 2003 13:32:28 GMT
Hello,

I believe this is what you want.

      <!-- parameter are defined within the ResourceParams" -->
      <pattern value="parameter">

        <!-- map the parameters elements to the ResourceParams -->
        <call-method-rule methodname="addParameter" paramcount="2" />
        <call-param-rule  pattern="name"  paramnumber="0" />
        <call-param-rule  pattern="value" paramnumber="1" />
      </pattern>

HTH.

Stephen Lafredo
Merck & Co., Inc.
USHH IS Application Architecture, WP97-A315
V: (215) 652-2668
E: stephen_lafredo@merck.com


-----Original Message-----
From: Marco.Mistroni@nokia.com [mailto:Marco.Mistroni@nokia.com] 
Sent: Friday, April 18, 2003 8:57 AM
To: commons-user@jakarta.apache.org
Subject: defining rules in XML


hi all,	
	 i have following XML file

<myproperties>
  <property name="foo" value="bar"/>
  <property name="foo2" value="bar2"/>
  ....
</myproperties>

and i would like digester to populate a java.util.Properties object while
parsing, using an XML rule file

but, i m stuck in how to write the proper rule...
i have written followign but seems not to work....

<?xml version="1.0"?>
  <digester-rules>
     
     
     <object-create-rule pattern="myproperties"
classname="java.util.Properties" />

     <pattern value="properties/property">
        
        
	<!??????? <call-method-rule  pattern="name" methodname="setProperty"
paramcount="2" /> -->        
        
   
     </pattern>

    

  </digester-rules> 

i don't know how to write properly the 'call method rule'....

anyone can help me?

br
	marco






> -----Original Message-----
> From: ext Baltz, Kenneth [mailto:Kbaltz@firstam.com]
> Sent: 13 February, 2003 18:50
> To: Jakarta Commons Users List
> Subject: RE: Digester question
> 
> 
> > 
> > 
> > Is it possible to handle duplicate elements in commons
> digester using
> > the following example ?
> 
> Yes.  Digester will fire whatever rules you assign to the
> given element as
> many times as that element appears.
> 
> > 
> > 
> > <phonebook>
> > 	<entry>
> > 	 <owner>Owner</owner>
> > 	 <number>Number</number>
> > 	 [ and many other numbers to follow..]
> > 	 </entry>
> > </phonebook>
> > 
> > I can handle many <entry> elements but can't quite yet grasp
> > how to do 
> > the multiple number elements. Does anyone have any idea how 
> > to do this ?
> 
> It depends on what you want to do with these elements.
> Originally I was
> going to say that you handle <number> exactly the way you 
> handle <entry>,
> there's no difference.  Give us a description of what you 
> would like to have
> happen and we can tell you how to do it. 
> 
> I'm guessing that you have something like an Entry bean, with an owner 
> property and a numbers property that returns a collection.
> If you have a
> method addNumber() in your Entry bean, then just use a 
> SetNextRule() to call
> addNumber and pass the contents of each <number> to your Entry bean.
> 
> K.C.
> 

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


------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck
& Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary
copyrighted and/or legally privileged, and is intended solely for the use of the individual
or entity named on this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by e-mail and then delete it.

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


Mime
View raw message