Re: [blogite] PingBack description files

Date view Thread view Subject view Author view Attachment view

From: Simon Willison (simon@incutio.com)
Date: Sat Sep 07 2002 - 18:06:01 BST


At 17:35 07/09/2002 +0100, Simon Willison wrote:
>One potential problem with the above is that interface details are
>contained as a single block of CDATA. This is pretty inflexible - for
>example, it would be better if PingBack servers were indicated with a
>host, path and port and it would be good if email addresses could request
>a specific subject. Any ideas for a way of adding that to the above format
>without bloating it with too many elements (it would be good if it was
>extendable as well, so the format could be used to specify a new format
>like instant messenging via jabber without needing any extra elements or
>attributes added to the DTD).

I've got a solution. Unfortunately it uses XML namespaces - is this a big
problem? I've only just got my head around them and I'm not overly keen on
adding something complicated like namespaces to the spec for no good
reason. That said, I think this is a pretty cool way of using them :)

Basically, each interface type has its own set of elements defined in its
own DTD. The XML-RPC interface for example needs port, path and host
elements. The email interface needs address and subject elements. A jabber
interface might need elements of its own. Each interface is given a
namespace on the pingback.net domain - then when additional interfaces are
added later on it can be done by giving them a new interface. The example
file now looks something like this (I may have got the syntax wrong, this
is the first time I've used XML namespaces):

<pingback
   xmlns:xmlrpc="http://pingback.net/namespaces/xmlrpc"
   xmlns:email="http://pingback.net/namespaces/email"
   xmlns:get="http://pingback.net/namespaces/get"
>
   <interface type="xmlrpc">
     <xmlrpc:host>www.bath.ac.uk</xmlrpc:host>
     <xmlrpc:path>/~cs1spw/blog/pingback/server.php</xmlrpc:path>
     <xmlrpc:port>80</xmlrpc:port>
     <alternatives>
       <interface type="get">
         <get:url>http://www.bath.ac.uk/~cs1spw/blog/pingback/GET.php>
         <get:from>pageLinkedFrom</get:from>
         <get:to>pageLinkedTo</get:to>
       </interface>
     </alternatives>
   </interface>
   <interface type="email">
     <email:address>
simon@incutio.com</email:address>
     <email:subject>I've linked to your site</email:subject>
   </interface>
</pingback>

As you can see, each interface type now has its own namespace and its own
set of elements. New interface types can be defined without changing the
basic PingBack specification or DTD.

Keep the ideas flowing :)

Simon

-- 
Web Developer, www.incutio.com
Weblog: http://www.bath.ac.uk/~cs1spw/blog/
Message sent over the Blogite mailing list.
Archives:     http://www.aquarionics.com/misc/archives/blogite/
Instructions: http://www.aquarionics.com/misc/blogite/

Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.5 : Sat Sep 07 2002 - 19:05:01 BST