(I apologize if this comes late, I receive the "digest" rather than being swamped with e-mails...)
I'm mostly guessing here, but I believe the reason for a "running" XML document is for the implicit connection status this provides. If the document is still open (and there hasn't been an ungraceful disconnect of some sort), then the client is still connected to the server, and vice versa. I'm sure temas or stpeter will provide better explanations...(-: As far as Java-based XML libraries go, dom4j *can* handle this (incoming) just fine, as long as you use its XPath-based "event processing" features (which return dom4j ElementPath objects, from which you get a complete Element/Attribute/Text/etc...). For outgoing XML, there's some fiddling you can do with dom4j's XMLFormatters to get it to not write the closing tag for a specific element (me personally, I've pretty much just encode that first element line by hand). Also, when it comes to incoming streams of XML, dom4j will need to use it's internal parser (AElfred). This is done in one of two ways: making sure _no_other_XML_parser_ is on the classpath, or setting the property org.xml.sax.driver to the fully-qualified name of the AElfred parser (which I believe is "org.dom4j.io.aelfred.SAXDriver"). I'm not very familiar with JDOM, so I cannot answer for that one. Otherwise, you could just use AElfred directly (it can be obtained at "http://www.opentext.com/services/content_management_services/xml_sgml_solut ions.html#aelfred_and_sax"). Hope this helps you out, -----Original Message----- From: zak [mailto:[EMAIL PROTECTED]] Sent: Friday, January 04, 2002 4:42 PM To: [EMAIL PROTECTED] Subject: [JDEV] just wondering... hi all, i was just wondering why the opening xml stream was designed to work the way it does. my question really is why can't/should't/doesn't the opening xml stream contain a closing element? what is the rationale behind keeping a running xml document going for the duration of the session. furthurmore, it makes it akward to use some of the handy XML libraries out there like JDOM, dom4j, etc. because many of the classes require well formed xml. i know that the sax parser makes it possible to deal with non well formed xml, but i'd prefer to just drop the data returned by the server in to some sort of document class instead of using a sax handler to pick out the individual xml elements i'm interested in. plus using the sax parser to directly read from a socket inputstream has it's own associated issues i'd like to avoid. for example, instead of sending this... <?xml version='1.0' encoding='UTF-8' ?> <stream:stream to='jabber.org' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'> doesn't it make sense to send... <?xml version='1.0' encoding='UTF-8' ?> <stream:stream to='jabber.com' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'> </stream:stream> i'm interested to hear how other people are dealing with this, and how any of you are using libraries such as JDOM. i'm not slamming the implementation. just curious. regards, zak. _______________________________________________ jdev mailing list [EMAIL PROTECTED] http://mailman.jabber.org/listinfo/jdev
