From: Sean Russell Date: 2001-11-14T05:10:20+09:00 Subject: [ruby-talk:25061] RE: REXML Question (Re: XML libraries (Re: Re: ruby and webser vices)) Ben Schumacher wrote: > However, when I create the element with REXML it ends up being closed: How have you seen this done in other XML toolkits? REXML closes tags, because any call to Element.write (should) produce a valid XML document. This requires that all tags be closed. Specifically, REXML will *read* documents in a stream, but it won't create them that way; internally, all REXML documents that are programmatically created are document trees. > xmlns:stream='http://etherx.jabber.org/streams'/> > > I figure I could probably work around this easily enough by writing the > output to a string and then removing the slash, but I was wondering if > somebody else had a better solution? (I could, of course, build the entire > opening element manually and not use REXML, but I'd prefer not to do > this.) Hmmm. Interesting problem. If the stream is one large document on a single socket, it might be easier to hand-craft the opening tag (it isn't complicated, is it?) and then use the XML toolkit to generate the individual tags, closing the tag at the end by hand. I could provide a solution in REXML by providing a Element.start_tag() and Element.end_tag() methods, but I'm hesitant to complicate the API if this is a single-use (or extremely rare) need. I'm open to suggestions. -- --- SER