I'm not suggesting that you add it to REXML, as I think it doesn't really fit. It is a rather rare case, after all. I was really just curious if somebody had an idea for the best way to work around it. Building the initial <stream:steram> element is relatively simple right now, but it is always *possible* that it might change with the protocol. One of the advantages of the Jabber protocol is that it is XML and therefore *extremely* flexible and I could see a potential for somebody wanting to add an attribute (rather than change the values of the current attributes) to implement some special use. For right now, I'll just ignore that and build it with the current possible standards. Just curious if somebody had some insight I missed. Thanks, Ben -----Original Message----- From: Sean Russell [mailto:ser / germane-software.com] Sent: Tuesday, November 13, 2001 1:10 PM To: ruby-talk / ruby-lang.org 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. > <stream:stream xmlns='jabber:client' to='jabber.com' > 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 <stream:stream> 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