commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: parse xml with digester
Date Tue, 28 Oct 2008 15:43:20 GMT
While vtd-xml looks interesting, I don't see how it is relevant to the
original question.

If the input really is as trivial as the example, then perhaps just
simply using the SAX api directly would be better.

If the example is a simplified version of the real input to be processed
(or the format might change in future), then Digester is a very good
choice. It can handle the example input, and similar structures. The
digester examples I pointed to show how to do this.

If the java object also has to be written back out to xml, then Betwixt
might be better than Digester, as digester only does xml->object.
However IMO betwixt is more complicated to use, so I would suggest
avoiding it unless two-way mapping really is needed.

Regards,
Simon

jimmy Zhang schrieb:
> Also you may want to try to try vtd-xml, which just releases an
> extended edition supporting
> 256 GB max file size
>
> http://vtd-xml.sf.net
>
>
> ----- Original Message ----- From: "Simon Kitching"
> <skitching@apache.org>
> To: "Commons Users List" <user@commons.apache.org>
> Sent: Tuesday, October 28, 2008 2:47 AM
> Subject: Re: parse xml with digester
>
>
>> Digester has extensive examples. See here:
>>
>> http://svn.apache.org/repos/asf/commons/proper/digester/trunk/src/examples/
>>
>>
>> These examples are also in the digester "source distribution" download.
>>
>> Regards,
>> Simon
>>
>> Peter_Ford@blm.gov schrieb:
>>> If you're mapping a POJO to XML and vice-versa, I'd consider looking at
>>> Commons Betwixt rather than messing with Digester directly.
>>>
>>> --Pete
>>>
>>> mteccles <mark.t.eccles@googlemail.com> wrote on 10/26/2008 06:22:59
>>> PM:
>>>
>>>
>>>> Hi,
>>>>
>>>> I have an XML document like follows:
>>>>
>>>> <item att1="" att2="">
>>>>    <item att1="" att2="">
>>>>       <item att1="" att2="">
>>>>       </item>
>>>>    </item>
>>>>    <item att1="" att2="">
>>>>    </item>
>>>> </item>
>>>>
>>>> Simply a nested structure of one complex element having two required
>>>> attributes.
>>>>
>>>> I write a POJO that match this structure, what code would read the xml
>>>> document and parse into the Java object? 


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


Mime
View raw message