[jdom-interest] Split document output

Benjamin Kopic ben at kopic.org
Mon Mar 4 14:50:55 PST 2002


I am about to something similar so I am quite intrigued by this issue.

How deep is your XML tree? If it is relatively flat, you may want to look
into SAXOutputer. Otherwise, try subclassing XMLOutputer and output once
text once you reach a leaf node. I presume you are constructing a Document
object in memory from scratch? Do you have to have Document in memory?

Best regards

Ben

> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of BOROVOY Noam
> Sent: 04 March 2002 13:13
> To: 'Camille Troillard'
> Cc: 'jdom-interest at jdom.org'
> Subject: RE: [jdom-interest] Split document output
>
>
>
> This isn't for parsing the document it's for writing it - outputting XML
> doesn't seem complex - until you start working with schemas and
> namespaces... JDOM is great for handling the namespaces and also encoding
> the content and escaping XML entities.
>
> 	----------
> 	From:  Camille Troillard [SMTP:camille at odaiko.com]
> 	Sent:  04 March 2002 13:24
> 	To:  BOROVOY Noam
> 	Cc:  'jdom-interest at jdom.org'
> 	Subject:  Re: [jdom-interest] Split document output
>
> 	Hello,
>
> 	I think you need to use something less "high-level" than JDOM.
> 	You should take a look at SAX compliant parsers (please correct me
> if I
> 	am wrong or not precise enough.)
>
> 	SAX is an XML parser specification based on event sending, that is
> why
> 	you can handle very big files with SAX.  On the other hand, DOM
> "needs"
> 	to load the whole model into memory which is best for small
> documents.
>
> 	Camille
>
>
> 	On Monday, March 4, 2002, at 12:37 PM, BOROVOY Noam wrote:
>
> 	> I'm a JDOM newbie, and have run into the following problem:
> 	> At times I need to generate very large XML documents (100's of
> megs) -
> 	> therefore making creating the full document tree in memory not
> 	> practical -
> 	> what I would like is to be able to output the document's opening
> tags,
> 	> then
> 	> generate and output a large number of elements one by one, and
> then
> 	> output
> 	> the closing tags of the document.
> 	> As is this does not seem possible with JDOM - so I need to "hard
> code"
> 	> the
> 	> opening and closing portions of the document and root element.
> 	>
> 	> Any ideas welcome...
> 	>
> 	> Thanks,
> 	> Noam
> 	>
> 	> _______________________________________________
> 	> To control your jdom-interest membership:
> 	> http://lists.denveronline.net/mailman/options/jdom-
> 	> interest/youraddr at yourhost.com
> 	>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yourad
dr at yourhost.com




More information about the jdom-interest mailing list