From: Todd B. <TBr...@ja...> - 2001-05-04 19:44:11
|
Peter Farmer wrote: > Your correct that it is valid XML . Entities are allowed in > attributes, > though I'd personally steer clear of them. Unfortunately, I have no control over that, as I'll explain below. > One of the reasons I do (apart from never having needed to use them ) > is that TclXML doesnt support them yet 8-). Its not a bug, its a > _missing_ feature .... At the moment I dont know when it > will added. It > depends on how much demand for it there is and how much time > we can make > to work on it. Some paying clients have our almost undivided attention > at the moment 8-). Fair enough, I suppose. > And the tclxml list has been awfully quite , it seems there's not much > interest . It would be nice to know if anyone's using it > seriously - it > cant be that good that no-one finds fault or lack with it 8-). I'm using it fairly seriously. Here's what I do with TclXML. First, some background. In case you have never heard of it, there's an open source instant messaging system called Jabber (www.jabber.org). The Jabber movement has been gaining a great deal of momentum over the past few months and there are now some- thing like 50,000 independent Jabber servers around the world. I work at Jabber.com, which exists to provide commercial software and services to add to the Jabber network. Other than the facts that Jabber is open source, is instant messaging independent of Microsoft, Yahoo!, and AOL, the coolest thing about Jabber is that the protocol is all XML. Before I got involved in Jabber, someone wrote a Tcl/Tk Jabber client called zABBER, which I have since taken over maintenance of (what little maintenance there is--the client is best described as "alpha" quality and hardly anybody uses it, so I haven't been adding new features or fixing bugs). Recently, though, I have written several utilities in Tcl (using Expect) to act as specialized Jabber client programs and server side components. Two of the most used Tcl programs I've written are called "Jabberbot" and "updateagent". The first is a chat bot for use at Jabber.com's public Jabber server. It receives and automat- ically responds to instant messages from users, including handling some very basic tech support issues on its very own! The second is a service that also runs on Jabber.com's public Jabber server and tells Jabber clients when there is a new version of themselves available for download. Both of these programs are Expect scripts and both use TclXML to parse the XML data stream coming from Jabber clients and server compon- ents. The Jabber protocol says that each user in the Jabber network will have a unique Jabber ID. This ID looks a lot like an email address. For instance, my Jabber ID right now is: "tbr...@ja.../WorkJIM" As with email, the tbr...@ja... means that my username is tbradley and I use the jabber.com Jabber server. The stuff after the slash ("/WorkJIM") is called a "resource" and is user configurable to give a unique description of where you're connecting from. So, unlike ICQ and other IM systems, you can actually be connected to the Jabber network multiple times. For instance, I might be con- nected on my work PC and on my cell phone and on my home PC all at the same time. So, I might be simultaneously using JIDs of: "tbr...@ja.../Work PC" "tbr...@ja.../Nokia 5900" "tbr...@ja.../Home PC" So, given this Resource field to play with, some users inevitably decide to put funky things like ampersands in there, such as "bu...@ja.../Black & White" The ampersand gets converted to "&" in the XML data stream, and then that has to be parsed correctly by the client program on the receiving end. See here for more: http://docs.jabber.org/jpg/html/main.html#CH-ENTITY-TIER-RESOURCE Right now, any user who tries to get update information from our Jabber server or who tries to chat with Jabberbot and has a re- source with an ampersand generates XML which cannot be parsed by the TclXML parser. I've gotten around the problem by just ignoring those users for now, which isn't very polite, but at least my Expect script doesn't crash. I could do something hokey like scan the XML for something that looks like a resource, chop it off, pass the XML to the parser, and then re-insert the resource afterwards. But I'm sure you'll agree that isn't a very elegant solution. So, there you go. That's what I use TclXML for. Todd. |