XML authoring for Atom
Since moved nodesets over to my own website, I'm now
authoring atom 0.8 in emacs, with namespaced elements. This one
<x:p> paragraph. This is the
first time I've authored in this way, and it's not easy, or at
least not as easy as it is without namespaces. When I first read
the namespace rec, I took away this simplistic impression that
namespaces were inherited. I thought that if I opened a document
in namespace a, specifying the namespace on that element, then
that namespace would remain in force until I changed it. Too
simplistic? Perhaps, but think how easy it would have been to
write using such an idea
<a xmlns='namespace 1'> <b>this would be in ns1 <c>This too</c> </b> <d xmlns='namespace 2> But this would change the ns <e>And this would be in namespace 2</e> </d> </a>
I'm not sure if this is clear, but the intent should be. The namespace associated with an element is the one declared in the nearest ancestor. The lack of a namespace declaration is immaterial. If namespaces are in use in a document, then every element is within at least one namespace. Namespaces declared in ancestors of the nearest one are less closely associated, hence processors can ignore them.
The advantages I see in this form of editing are that the author is freed from using prefixes, which I guess is what I'm railing against, the editorial overhead of writing them. The disadvantage is that I need to repeat the actual namespace each time I use it, which leaves more room for error than typing a prefix. I guess some bright spark could come up with a syntax that works around that. My goal is to remove the need to write them.
End of rant
For some time now, I've been using plain text as a way of writing notes to myself, to remind me of something, to keep a note
of a useful url etc. Believing I'd have a use for these in XML, I wrote some Python to convert these to XML. Thinking of my
last entry http://www.dpawson.co.uk/nodesets/entries/050627.htmland reading (almost inadvertently) a piece by Martin Fowler on mini languages, http://martinfowler.com/articles/languageWorkbench.html#ASimpleExampleOfLanguageOrientedProgrammingI started to think about content generation in plain text. Looking at the xhtml body content of an entry, I started by just processing that part. So I'm writing this one in plain
text, and processing it to get output in xhtml, with a wrapper of
<x:div> such that it can be placed directly within the
<a:content> element At a basic level, it all seems to be working.
Or not, in this case. Am I the only one that feels that XML markup is a bit of a waste of time at the detail level? Whilst still being absolutely convinced that XML is right as a data interchange format, as a format for retaining documents over a long period, and that complex structures really should be manually marked up by hand; I'm not in the least convinced that I'm any better than my machine at generating pointy brackets in the right place. I won't speculate just where the break point is, but for docheads, I'm sure machine processing of plain text is more of a help than a hinderance.
Now lets see if I can slot this content into another blog entry.
Keywords: atomComments (View)
Return to main index