commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim O'Brien <tobr...@discursive.com>
Subject Re: Digester Question
Date Tue, 23 Dec 2003 18:52:57 GMT
I do not know of any problem, but then again, I only use Betwixt in a very 
straightforward situation.

If you would like to check on the open issues in Bugzilla, here is the 
link:  
http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=&emailtype1=substring&emailassigned_to1=1&email2=&emailtype2=substring&emailreporter2=1&bugidtype=include&bug_id=&changedin=&votes=&chfieldfrom=&chfieldto=Now&chfieldvalue=&product=Commons&component=Betwixt&short_desc=&short_desc_type=allwordssubstr&long_desc=&long_desc_type=allwordssubstr&bug_file_loc=&bug_file_loc_type=allwordssubstr&keywords=&keywords_type=anywords&field0-0-0=noop&type0-0-0=noop&value0-0-0=&cmdtype=doit&order=%27Importance%27


Betwixt is a helpful utility, it has been sitting at an alpha 1.0 stage 
for a bit too long.  I'll agitate on the commons-dev list, and roust some 
answers out of the group.

Tim



On Tue, 23 Dec 2003, Juan Alvarado wrote:

> Ok will do.
> 
> Can you tell me if even though it is in alpha release, if you've  
> encountered or heard of any major problems with it.
> 
> Thanks
> 
> On Dec 23, 2003, at 12:46 PM, Tim O'Brien wrote:
> 
> > I left out more detail, especially concerning the situation where the  
> > Play
> > bean contains a property that happens to be a Character bean.
> >
> > Please also see the very well written online docs with Betwixt:
> > http://jakarta.apache.org/commons/betwixt/guide/binding.html
> >
> > If you notice any glaring omissions please feel free to this community
> > know.
> >
> > Tim
> >
> > On Tue, 23 Dec 2003, Juan Alvarado wrote:
> >
> >> Tim:
> >>
> >> Thanks for the help and the sample code. I really appreciate it. This
> >> will help us  get up and running really fast.
> >>
> >> Take care,
> >>
> >> On Dec 22, 2003, at 8:23 PM, Tim O'Brien wrote:
> >>
> >>> Juan, the Digester is pretty straightforward, I'd recommend using the
> >>> XML rules sets.
> >>>
> >>> As far as Object -> XML, try using Betwixt.  It is very  
> >>> straightfoward.
> >>>
> >>> Assume you have a Play JavaBean with a genre, year, language, and
> >>> author properties.
> >>>
> >>> Create a file named "Play.betwixt", and make sure that it resides in
> >>> the classpath as a sibling to Play.class.
> >>>
> >>> <info primitiveTypes="element">
> >>>  <element name="play">
> >>>    <attribute name="genre" property="genre"/>
> >>>    <attribute name="year" property="year"/>
> >>>    <attribute name="language" property="language"/>
> >>>    <addDefaults/>
> >>>  </element>
> >>> </info>
> >>>
> >>> *** Then you can use the code below to write out an XML file.
> >>>
> >>> Play play = new Play();
> >>> play.setGenre( "blah" );
> >>> play.setYear( 1232 );
> >>> play.setLanguage( "Danish" );
> >>> play.setAuthor( "Ali G.");
> >>>
> >>> BeanWriter beanWriter = new BeanWriter();
> >>> beanWriter.enablePrettyPrint();
> >>> beanWriter.write(play);
> >>> System.out.println(beanWriter.toString());
> >>>
> >>> *** This will spit out something like this:
> >>>
> >>> <play genre="blah" year="1232" language="Danish">
> >>>  <author>Ali G.</author>
> >>> </play>
> >>>
> >>> So, in other words, using Betwixt is as easy as creating a series of
> >>> .betwixt files that you place in the Classpath.
> >>>
> >>> Good Luck.
> >>>
> >>>
> >>> Juan Alvarado wrote:
> >>>
> >>>> Hello:
> >>>>
> >>>> I am relatively new to xml parsing and I just started using the
> >>>> commons-digester tools and it seems like it might fit my needs.
> >>>>
> >>>> First let me apologize to all you seasoned pros in the field of XML
> >>>> in the event that my question seems too simple or if I am just not
> >>>> using the right terminology.
> >>>>
> >>>> My question is as follows.
> >>>>
> >>>> The particular XML that I am working with and in need to parse is
> >>>> composed as follows:
> >>>>
> >>>> <?xml version="1.0"?>
> >>>> <IDTDebitInterface>
> >>>> <UserInfo>
> >>>> <username>Juan</username>
> >>>> <password>Alvarado</password>
> >>>> </UserInfo>
> >>>> <DebitRequests ReportSuccesses="true">
> >>>> <DebitRequest id="1" type="misctrans">
> >>>> <account>123</account>
> >>>> <amount>10</amount>
> >>>> <transtype>vendordebit</transtype>
> >>>> <note>Test</note>
> >>>> <balancetozero>n</balancetozero>
> >>>> </DebitRequest>
> >>>> </DebitRequests>
> >>>> </IDTDebitInterface>
> >>>>
> >>>> As you can see, the node <DebitRequests ReportSuccesses="true">
> >>>> contains an attribute ReportSuccesses="true". I need to be able to
> >>>> grab that value so that it can be populated into my corresponding
> >>>> bean. Additionally there might be times when there is more than one
> >>>> attribute in a given node and obviously I would need to get those
> >>>> values also. Could someone please tell me if this is possible and if
> >>>> so, how to accomplish this.
> >>>>
> >>>> NEXT QUESTION:
> >>>>
> >>>> My application not only has to parse this XML stream, but we also
> >>>> have to create this XML from in certain situations. We might for
> >>>> example receive a request through the web with the necessary
> >>>> parameters and values needed to construct the XML and then pass on 

> >>>> to
> >>>> the next layer. Can anyone tell me if the digester framework can
> >>>> handle this and if so, I'd appreciate some sample code.
> >>>>
> >>>> Thanks in advance.
> >>>>
> >>>>
> >>>> --------------------------------------------------------------------

> >>>> -
> >>>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >>>> For additional commands, e-mail:  
> >>>> commons-user-help@jakarta.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >>
> >>
> >>
> >
> > -- 
> > ----------------------
> > Tim O'Brien
> > Evanston, IL
> > (847) 863-7045
> > tobrien@discursive.com
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

-- 
----------------------
Tim O'Brien
Evanston, IL
(847) 863-7045
tobrien@discursive.com



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