commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramin Heidari <ramin.heid...@hotmail.com>
Subject parse xml Tag with same attributes
Date Sat, 10 Mar 2012 11:38:09 GMT

Hi,
i want to pars an xml but I have a got a problem in defining rule for below part of xml because
there are two same <Name> tage with different attributes .i set the rule but it seems
that i won't work(alway the value set null).Do you have any idea who i can fix it.
XML........................        <Match MatchId="4616735">          <MatchDate>2011-01-05T07:30:00</MatchDate>
         <Team1 TeamId="1029369">            <Name language="en">Wellington Phoenix
FC</Name>            <Name language="se">Wellington</Name>          </Team1>
         <Team2 TeamId="529088">&nb
 sp;           <Name language="en">Melbourne Victory</Name>            <Name
language="se">Melbourne Victory</Name>          </Team2> .........................

        //A new Course instance        digester.addObjectCreate("LivescoreData/Sport/Category/Tournament/Match",
Match.class);
        //A new Course instance        digester.addObjectCreate("LivescoreData/Sport/Category/Tournament/Match/Team1",
Team1.class);
        digester.addSetProperties("LivescoreData/Sport/Category/Tournament/Match/Team1","TeamId","teamId");


        digester.addBeanPropertySetter("livescoreData/sport/Category/Tournament/Match/Team1/Name","name");
       // digester.addCallMethod("livescoreData/sport/Category/Tournament/Match/Team1/Name",
"setName", 1 );

        digester.addSetNext("LivescoreData/Sport/Category/Tournament/Match/Team1", "addTeam1");
        digester.addObjectCreate("LivescoreData/Sport/Category/Tournament/Match/Team2", Team2.class);
       digester.addBeanPropertySetter("livescoreData/sport/Category/Tournament/Match/Team2/Name","language_en");
        digester.addSetNext("LivescoreData/Sport/Category/Tournament/Match/Team2", "addTeam2");

thanks,Ramin



 

 		 	   		   		 	   		  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message