Ethan and I have been talking a lot about the kind of xml editing environment that is available out there for free, or cheaply (read: to academics). I’m becoming more and more convinced that there isn’t yet a good editor for what I’d like to do. iBoggle at this! What I’d like to do is relatively simple, compared with the wild and crazy things people do with XML nowadays.
- I’d like to edit documents without a DTD. While I’m encoding a file semantically, which constitutes research, I can’t have a DTD in place by definition, until I’ve encoded the document (possibly several times). Thus, I don’t care if myfile.xml validates against a pre-set DTD. I only care whether it’s well-formed.
- I’d like to be able to highlight text, and with a keyboard or mouse shortcut call up a menu of all the elements I could possibly use at this point in the document, based on the elements I’ve used thus far. Once an element is inserted, it would also be grand to get a menu of the attributes used in it up until now. In both cases, there should be an option to add a new element or attribute.
- I’d like to be able to view the thing in different modes – a full-on text mode, with all of the source right there, and perhaps a more wysiwyg mode, in which the cursor’s position would trigger a display of what element(s) I’m in at the moment, somewhere on the side.
- I’d like for the editor to then be able to extrapolate a DTD from my code, if I ask it to do so. Or tell me exactly why it can’t.
This is the wish list so far. Of all the editors I’ve seen, only XMetaL and <oXygen/> have half-way decent interfaces. The former is only available for Windows. The latter is excruciatingly uncustomizeable, or else the Windows version is different from that made for the Mac, or else-else, the trial version does not include all the features of the full version. While that last option seems more probable the more I play with oXygen, documentation didn’t bother to mention it, and I spent so much time beating my head against it, that frankly, I’m not inspired to pay the $48 for an academic license. Moreover, the feature I want most – being able to quickly surround text in tags based on the tags I’ve used so far in the document – is wildly unreliable. If I create a new element, the program will not see it until I close and re-open the document; and even then, at any given point I get a seemingly arbitrary list of available elements.
Enough bitching, I just wanted to formulate all of this in writing while I’m in the middle of it. If anyone knows of an already-existing program that does what I want to do, let me know!

I was just reading about a Python library called gnosis which can extrapolate a DTD from XML. If your editor can’t do it by itself, you could set it up to trigger gnosis.DTDGenerator.
I read about it in http://www-106.ibm.com/developerworks/linux/library/l-pymeta.html, under the heading “More ways to solve problems with magic”, but that’s not a very good introduction because it’s just an example buried in the middle of a detailed technical article. Google should be able to find more.
Vika
What about emacs?
It meets your number one requirement.
It may meet your number two requirement. emacs can be run in a mode where validation has to be invoked. If you are encoding according to a DTD generated from for example the TEI Guidelines, you still have access to a listing of elements and attributes available at the given insertion point [that’s part of your number three requirement]. This of course doesn’t meet your requirement to generate DTD from what has been encoded. However you could generate the DTD from another application and then use emacs functionality. (And since emacs is programmable, you might find a LISP guru to write the routine that allows you to interface with the DTD-generation application from within emacs.)
The TEI has created a distribution of emacs that comes with XSLT files that allow you to transform the XML into various outputs and, I believe, to view the output from within emacs.
There is an emacs version for use on Windows operating systems. I myself use emacs and run it on a iMac running Virtual PC. I use a DTD from the Text Encoding Initiative. And Saxon (an XSLT engine) (acquired with the emacs package via the TEI)to transform the file and then open it in a text or html browser depeding upon the output I chose. Saxon can be invoked from within emacs if a stylesheet processing instruction is embedded in the XML file.
I find it rather easy to toggle between emacs, an MS-DOS prompt window to run Saxon and a browser window. FREE!
For more info about the TEI
http://www.tei-c.org/
And software
http://www.tei-c.org/Software/index.html
P.S. The TEI also has a discussion list where you can post questions about XML editors. And gets lots of help with encoding, especially if you choose to go the TEI route.
P.P.S. I do a bit of blog-like serial publication authored in TEI-conformant XML with the above set up. Authoring in TEI-conformant XML gives me the appropriate combinations of flexibility and rigour for exploring the content modelling and encoding questions as the project evolves.
See Entry 116 “Copy, Paste, Paste” for a mini-celebration of some of the features of emacs
http://www.chass.utoronto.ca/~lachance/jardin/html/blogTEI.htm#116
Try it! You might like it.
Francois-
I have, of course, used emacs. :) Extensively, even, and with a TEI-Lite-based DTD to boot. This was our MO when we were encoding the Decameron, and let me tell you, never ever again.
It’s ugly. It doesn’t indent properly. It’s ugly. It has a Very Limited capability to color-code syntax, from what I’ve seen. It’s ugly. It is extremely powerful, but there’s an idiosyncratic command for everything, and I’m just not willing to learn ’em all. Have I mentioned it’s ugly?
Don’t get me wrong: I know that it’s probably more powerful as a text editor than any prettier, window-based software out there. But I don’t want software that can do Everything, I want something that is easy on the eyes.
Another huge disadvantage of emacs is that you can’t easily have (to speak nothing of ‘toggle between’) different views of the same document. These are all things I’d like to have. I’m capable of using emacs, but generally speaking it’s too much effort for relatively simple tasks, you know?
Okay, it’s ugly.
I bet in a little while someone doing a search on the string “ugly emacs” might get directed to your blog entry.
Can I pass some of your questions/comments on to the TEI list with a link to your blog entry? There may be some expertise to tap into there.
People will have recommendations about alternatives to emacs. They may also have recommendations about cheat sheets on how to customize emacs for colouring syntax. They may also have some tips on setting the indenting features.
What kind of support did you have for learning when you were encoding the Decameron?
Your remarks about different view made me look again and learn how to fold/unfold elements and hide/reveal attributes. I’m learning from your questions.
Your experience is making me think that the my toolkit should be expanded from emacs+browser to emacs + blog pals.
How would your time with the Decameron have been if you had a blog through which to mark your triumphs and sound that horn for help. Ah Roland, Roland, wherefore is thy name Vika?
*smile*
Whatever you decide. You have inspired me to contine to explore more of the emacs potential. Thanks.
Thanks, Francois, you’re very kind. For now I’d prefer to keep this off the TEI list (which I lurked for a couple of years, and only recently stopped reading). The truth is, I’m not using TEI’s encoding guidelines, not because I don’t think them worthy but because the DTDs make my head explode. Later on, if it proves useful to me or others, it should be possible to map my encoding scheme (which isn’t entirely worked out yet) onto a TEI DTD.
As for the support I had while encoding the Decameron: Well, it was at Brown, and we were working with the Scholarly Technology Group. However, there was little training, and – more importantly – no training could’ve substituted for practice practice practice.
Which I got in spades! I wasn’t the problem. The problem was that we had many encoders, some of them staying with the project for only a short time. There was a revision-control system in place; every encoder had to check files out and back in, and had to learn emacs. The problem there was different than my problem now: we had a high turnover of staff, as it were, and the learning curve for emacs is just too high. Especially when you only use it for one project, and for none of your other work.
Anyway. I do know that emacs is a very powerful word processor; I just don’t want to bother with it, or vi, or vim, if I don’t have to.
How would your time with the Decameron have been…
Whatchou mean, “have been”? I’m still with it, we just aren’t encoding the Decameron anymore. I have also encoded two minor texts for the project, and act as webmaster. Currently, we’re trying to plan out what to do with the next couple of years. If this plan involves any encoding, I think I’d like to figure out how to avoid emacs. :)
Good luck with the planning with Decameron.
Good luck with the search for the XML editor.
And all my best wishes for the encoding, or rather content modeling, you are about to emark upon. As you go along, feel free to send me a snippet and ask if I could attempt to translate to TEI-conformant markup. I offer because such a process of translation helps with the intellectual activity at hand (and selfishly gives me a sneek preview of what I deem to be some very important work). And as comfort levels grow such an exchange could be bloggable.
Go for it!