Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #7356

Re: large xml file...

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!news.osn.de!diablo2.news.osn.de!news.tele.dk!news.tele.dk!small.news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date Wed, 24 Aug 2011 19:10:26 -0400
From Arne Vajhøj <arne@vajhoej.dk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: large xml file...
References <j2uqp4$n8h$1@speranza.aioe.org> <4e5309a2$0$303$14726298@news.sunsite.dk> <j33gfr$u9l$1@speranza.aioe.org>
In-Reply-To <j33gfr$u9l$1@speranza.aioe.org>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
Lines 43
Message-ID <4e5584ec$0$304$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source
NNTP-Posting-Host 72.192.23.157
X-Trace news.sunsite.dk DXC=0?H]UcaT?>4Bi9D?DQ_c:4YSB=nbEKnk;TUCR5gQKU59JPe3\kP5EU1KBm9cfh9BS4M2;kT<[:>[1I=NC8FE6[]:FG`o:=^:\T>
X-Complaints-To staff@sunsite.dk
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7356

Show key headers only | View raw


On 8/24/2011 2:40 PM, boris wrote:
> On 08/22/2011 09:59 PM, Arne Vajhøj wrote:
>> On 8/22/2011 8:05 PM, boris wrote:
>>> I need to process large xml file and dump some documents to a different
>>> file based on content of some elements.
>>>
>>> let's say I need to check content of <text3> and dump the whole <doc> to
>>> a different file:
>>>
>>> <doc>
>>> <text1>
>>> <text2>
>>> <text3> ... etc
>>>
>>> </doc>
>>>
>>> I'm trying to do this using sax. Are there any examples how to do this?
>>> Is using sax ok for this task?
>>
>> SAX or StAX seems as the most obvious choices given the context.
>>
>> Any textbook SAX example should lead you to working code.
>>
>> I can post some code, but I doubt that it will show anything
>> various books and tutorials does not.

> I tried to accumulate the whole xml(<doc>...</doc>) as string using sax,
> but in this case all special characters are processed by parser
> and are just characters and not "predefined entities" like &quot;
>
> Using stax, I get correct xml, if I print events right away, but I if I
> store them in collection and print them later , I don't get the same
> result.

Any correct XML parser should convert the XML &quot; to a " in
a Java String.

Any correct XML formatter/serializer should convert it back again
when generating new XML.

Arne

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

large xml file... boris <boris@localhost.domain> - 2011-08-22 20:05 -0400
  Re: large xml file... Ian Shef <invalid@avoiding.spam> - 2011-08-23 00:43 +0000
    Re: large xml file... boris <boris@localhost.domain> - 2011-08-22 20:53 -0400
      Re: large xml file... boris <boris@localhost.domain> - 2011-08-22 20:55 -0400
        Re: large xml file... Ian Shef <invalid@avoiding.spam> - 2011-08-23 19:48 +0000
  Re: large xml file... Arne Vajhøj <arne@vajhoej.dk> - 2011-08-22 21:59 -0400
    Re: large xml file... boris <boris@localhost.localdomain> - 2011-08-24 14:40 -0400
      Re: large xml file... Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-24 18:59 +0000
      Re: large xml file... Arne Vajhøj <arne@vajhoej.dk> - 2011-08-24 19:10 -0400
        Re: large xml file... Stanimir Stamenkov <s7an10@netscape.net> - 2011-08-25 07:57 +0300
          Re: large xml file... RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2011-08-25 10:39 +0100
            Re: large xml file... Stanimir Stamenkov <s7an10@netscape.net> - 2011-08-26 08:47 +0300

csiph-web