Oki, but why don't you print the element as you go along, whitout bathering about the indention and then when the operation is completed let a loop parse through the tree and indent it as you wich....
I think it is more of a hazzel to create a sax pretty printer.... but then again it is always nice to get all the work done at once. (but on the other hand again, I think a such a tool already exist that fixes a XML file so it look good.... but I can't remember it's name right now...) Cheers Christian > -----Ursprungligt meddelande----- > Från: Eric Jain [mailto:[EMAIL PROTECTED]] > Skickat: den 15 juli 2002 16:00 > Till: dom4j > Kopia: Christian Holmqvist, IT, Posten > Ämne: Re: [dom4j-user] How to printing large XML files > > > > Why don't just use the XMLWriter as it is, there is a write(Element) > method > > in it... > > The issue is that the complete DOM model of the XML file I am > writing can't > be loaded into memory at once. Or, put differently, I need to > be able to > print as I read. > > XmlWriter of course always prints complete trees, which results in the > following output if one attempts to print a document element > by element > without keeping all elements in memory: > > <root xmlns:xsi="..."> > <element>...</element> > </root> > <root xmlns:xsi="..."> > <element>...</element> > </root> > <root xmlns:xsi="..."> > <element>...</element> > </root> > > > As a workaround one could manually print the root begin and end tags. > Unfortunately this strategy interferes with the proper > placing of namespace > prefixes as well as the indentation: > > <root> > <element xmlns:xsi="...">...</element> > <element xmlns:xsi="...">...</element> > <element xmlns:xsi="...">...</element> > </root> > > > This is what the output should look like: > > <root xmlns:xsi="..."> > <element>...</element> > <element>...</element> > <element>...</element> > </root> > > > Perhaps the proper solution would be to write the tree of > each element to a > SAX content handler. Does anyone know where to find a > pretty-printing SAX > handler? Seems like a rather basic thing, but I couldn't find > anything... > > > -- > Eric Jain > > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user