<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>toxicsoftware.com &#187; xbel</title> <atom:link href="http://toxicsoftware.com/tag/xbel/feed/" rel="self" type="application/rss+xml" /><link>http://toxicsoftware.com</link> <description>RANDOMIZE USR 0</description> <lastBuildDate>Thu, 22 Dec 2011 03:35:22 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Internet Clippings to XBEL</title><link>http://toxicsoftware.com/internet-clippings-to-xbel/</link> <comments>http://toxicsoftware.com/internet-clippings-to-xbel/#comments</comments> <pubDate>Sat, 03 Jun 2006 16:36:05 +0000</pubDate> <dc:creator>schwa</dc:creator> <category><![CDATA[Default]]></category> <category><![CDATA[Links]]></category> <category><![CDATA[mdfind2]]></category> <category><![CDATA[Spotlight]]></category> <category><![CDATA[WebNoteHappy]]></category> <category><![CDATA[xbel]]></category> <category><![CDATA[xslt]]></category><guid isPermaLink="false">http://toxicsoftware.com/internet-clippings-to-xbel/</guid> <description><![CDATA[I have thousands of Mac OS X url clippings files on my mac. These little files are reported by the finder as &#8220;Web Internet Location&#8221; files. They&#8217;re sometimes known as &#8220;weblocs&#8221; (due to their file extension) and look like this: &#8230; <a href="http://toxicsoftware.com/internet-clippings-to-xbel/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I have thousands of Mac OS X url clippings files on my mac. These little files are reported by the finder as &#8220;Web Internet Location&#8221; files. They&#8217;re sometimes known as &#8220;weblocs&#8221; (due to their file extension) and look like this: <img src="/uploads/Webloc.png" alt="Webloc.png" /></p><p>The reason I have so many of these things is that I switch browsers relatively frequently (bouncing between Safari and OmniWeb and occasionally Firefox) and I find weblocs are more permanent and just more convenient than browser bookmarks.</p><p>Mostly they&#8217;re &#8220;organised&#8221; into a single folder and I use Spotlight to find the ones I am interested in at that moment. However Spotlight doesn&#8217;t have a default webloc metadata importer, and this is where Toxic Software stands up to fill the gap. My <a href="/blog/spotlight-importer-collection/">Spotlight Importer Collection</a> package includes three importers, one of which as luck would have it is a webloc importer (in fact it also imports a plethora of other internet clipping files: afploc, fileloc, ftploc, inetloc, mailloc, urlloc and webloc).</p><p>After installing Toxic URL Importer and waiting for Spotlight to index your volumes each webloc (if you&#8217;re in a rush use mdimport to force Spotlight to index files immediately) you&#8217;ll be able to view a webloc&#8217;s URL directly in the finder: <img src="/uploads/WeblocInfo.png" alt="WeblocInfo.png" /></p><p>From Terminal.app you can use mdls to inspect the extra metadata added to the file by Toxic URL Importer:</p><pre><code>[schwa@cobweb] Desktop$ mdimport The\ XML\ Bookmark\ Exchange\ Language\ Resource\ Page.webloc 
[schwa@cobweb] Desktop$ mdls The\ XML\ Bookmark\ Exchange\ Language\ Resource\ Page.webloc 
The XML Bookmark Exchange Language Resource Page.webloc -------------
kMDItemContentType                    = "com.toxicsoftware.webloc"
kMDItemContentTypeTree                = (
    "com.toxicsoftware.webloc", 
    "com.toxicsoftware.urlloc", 
    "public.url", 
    "public.data", 
    "public.item"
)
kMDItemDisplayName                    = "The XML Bookmark Exchange Language Resource Page.webloc"
kMDItemID                             = 17168962
kMDItemKind                           = "Web Internet Location"
kMDItemURL                            = "http://pyxml.sourceforge.net/topics/xbel/"
org_spotlightdev_digest_sha1          = "794043e7673e525d654e7b8e4115636408182528"
org_spotlightdev_metadata_mdimporters = ("com.toxicsoftware.url-importer")
org_spotlightdev_metadata_url_host    = "pyxml.sourceforge.net"
org_spotlightdev_metadata_url_scheme  = "http"
org_spotlightdev_metadata_urls        = ("http://pyxml.sourceforge.net/topics/xbel/")
</code></pre><p>You can then search for weblocs by host or by scheme or a by any text in the url. Very handy:</p><p><img src="/uploads/Spotlight.png" alt="Spotlight.png" /> On the whole using weblocs and Spotlight together is a great solution. But I think I&#8217;ve found a better one. Luis de la Rosa&#8217;s <a href="http://www.happyapps.com/">WebNote Happy</a> is a fantastic application for managing bookmarks. It allows me to manage my bookmarks in a single window (like my folder of weblocs) and integrates really well with <a href="http://del.icio.us/">del.icio.us</a>. As fast as Spotlight searching is, WebNoteHappy beats it hands down with lightning fast searches.</p><p>Unfortunately WebNoteHappy doesn&#8217;t yet import or export webloc files (Luis is a very responsive developer and am sure will be making up for this minor deficiency in later releases). But fortunately WebNoteHappy does import <a href="http://pyxml.sourceforge.net/topics/xbel/">XBEL</a> files, which as I&#8217;ve already written about in my post about <a href="/blog/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/">OmniWeb and XBEL</a> is a very handy intermediate file format.</p><p>As it turns out I have almost all the tools necessary to get my thousands of weblocs files into WebNoteHappy. I have <a href="/blog/mdfind2-updated/">mdfind2</a>, which like its little cousin <a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/mdfind.1.html">mdfind</a> can perform Spotlight searches from the terminal. However mdfind2 can also export an XML file describing the metadata of the found items. All I needed to do was use mdfind2 to find all my webloc files and then transform the XML into XBEL via a custom written XSLT.</p><p>Here is the XSLT file &#8220;mdfind2_to_xbel.xsl&#8221;:</p><pre><code>&lt;?xml version="1.0" encoding="iso-8859-1"?&gt;  
&lt;xsl:stylesheet version="1.0"  
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;  

    &lt;xsl:output method="xml" indent="yes" doctype-public="+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" doctype-system="http://www.python.org/topics/xml/dtds/xbel-1.0.dtd"/&gt;  

    &lt;xsl:strip-space elements="*"/&gt;  

    &lt;xsl:template match="/"&gt;  
        &lt;xbel version="1.0"&gt;  
            &lt;xsl:apply-templates/&gt;  
        &lt;/xbel&gt;  
    &lt;/xsl:template&gt;  
    &lt;xsl:template match="item"&gt;  
        &lt;bookmark&gt;  
            &lt;xsl:attribute name="href"&gt;&lt;xsl:value-of select="attributes/attribute[@key='kMDItemURL']"/&gt;&lt;/xsl:attribute&gt;  
            &lt;xsl:attribute name="id"&gt;_&lt;xsl:value-of select="attributes/attribute[@key='kMDItemID']"/&gt;&lt;/xsl:attribute&gt;           &lt;xsl:attribute name="added"&gt;&lt;xsl:value-of select="attributes/attribute[@key='kMDItemContentCreationDate']"/&gt;&lt;/xsl:attribute&gt;  
            &lt;xsl:attribute name="modified"&gt;&lt;xsl:value-of select="attributes/attribute[@key='kMDItemContentModificationDate']"/&gt;&lt;/xsl:attribute&gt;  
            &lt;xsl:attribute name="visited"&gt;&lt;xsl:value-of select="attributes/attribute[@key='kMDItemLastUsedDate']"/&gt;&lt;/xsl:attribute&gt;  
            &lt;title&gt;&lt;xsl:value-of select="name"/&gt;&lt;/title&gt;  
        &lt;/bookmark&gt;  
    &lt;/xsl:template&gt;  
    &lt;xsl:template match="text()"&gt;&lt;/xsl:template&gt;  

&lt;/xsl:stylesheet&gt;
</code></pre><p>And here is the tiny snippet of shell script needed to tie it all together:</p><pre><code>mdfind2 --xml "kMDItemContentTypeTree == 'com.toxicsoftware.urlloc'" | \  
xsltproc mdfind2_to_xbel.xsl -  
</code></pre><p>And here is the final resulting XBEL file (limited to just a single entry) ready to be imported in WebNoteHappy:</p><pre><code>&lt;?xml version="1.0"?&gt;  
&lt;!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange Language 1.0//EN//XML" "http://www.python.org/topics/xml/dtds/xbel-1.0.dtd"&gt;  
&lt;xbel version="1.0"&gt;  
  &lt;bookmark href="http://www.txrollergirls.com/teams.htm" id="_9799996" added="2005-02-17 13:54:05 -0500" modified="2005-02-17 13:54:05 -0500" visited="2005-02-17 13:54:05 -0500"&gt;  
    &lt;title&gt;texas rollergirls TEAMS&lt;/title&gt;  
  &lt;/bookmark&gt;  
&lt;/xbel&gt;  
</code></pre><p>After running the script I now have all my weblocs safely imported into WebNoteHappy, with duplicates removed (in fact they were never imported in the first place). I can tag them and add them to del.ici.ous with just a click, and I can now import my current Safari bookmarks into the list and manage <em>all</em> my bookmarks in one place.</p><p>Using a little bit of custom coding (my URL Importer, mdfind2 and the XSLT) I was able to use the extensibility of Spotlight and WebNoteHappy to my advantage. A sure sign of how useful a piece of software is how easy it is to be extended by its end users.</p><p>Subversion Repository: <a href="http://toxic-public.googlecode.com/svn/tags/BlogTag_20070927_729/Projects/Misc/mdfind2_to_xbel">http://toxic-public.googlecode.com/svn/tags/BlogTag_20070927_729/Projects/Misc/mdfind2_to_xbel</a></p> ]]></content:encoded> <wfw:commentRss>http://toxicsoftware.com/internet-clippings-to-xbel/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Converting OmniWeb Bookmarks to XBEL (for WebNoteHappy)</title><link>http://toxicsoftware.com/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/</link> <comments>http://toxicsoftware.com/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/#comments</comments> <pubDate>Mon, 29 May 2006 16:46:23 +0000</pubDate> <dc:creator>schwa</dc:creator> <category><![CDATA[Default]]></category> <category><![CDATA[omniweb]]></category> <category><![CDATA[toxicsoftware.com]]></category> <category><![CDATA[WebNoteHappy]]></category> <category><![CDATA[xbel]]></category> <category><![CDATA[xml]]></category> <category><![CDATA[xslt]]></category><guid isPermaLink="false">http://toxicsoftware.com/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/</guid> <description><![CDATA[Long title, small program. WebNoteHappy is my new favourite bookmark manager. Unfortunately version 1.0 doesn&#8217;t import OmniWeb (a browser for which I have had a tempestuous on again/off again love affair for several years). I happen to know that forthcoming &#8230; <a href="http://toxicsoftware.com/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Long title, small program.</p><p><a href="http://www.happyapps.com/webnotehappy/">WebNoteHappy</a> is my new favourite bookmark manager. Unfortunately version 1.0 doesn&#8217;t import <a href="http://www.omnigroup.com/applications/omniweb/">OmniWeb</a> (a browser for which I have had a tempestuous on again/off again love affair for several years). I happen to know that forthcoming versions of WebNoteHappy will support OmniWeb amongst other browser but I am all about instant-gratification.</p><p>So newly checked into my new subversion repository (which now seems to be up and running fine) is <a href="http://toxic-public.googlecode.com/svn/tags/BlogTag_20070927_729/Projects/Misc/OmniWebToXBEL/">OmniWebToXBEL</a> (<a href="http://toxic-public.googlecode.com//archives/OmniWebToXBEL.zip">OmniWebToXBEL.zip</a>). This shell script uses sed, tidy and xsltproc to convert the OmniWeb bookmarks file into an <a href="http://pyxml.sourceforge.net/topics/xbel/">XBEL</a> file. You can then import the XBEL document into WebNoteHappy.</p> ]]></content:encoded> <wfw:commentRss>http://toxicsoftware.com/converting-omniweb-bookmarks-to-xbel-for-webnotehappy/feed/</wfw:commentRss> <slash:comments>12</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic
Database Caching 1/14 queries in 0.005 seconds using disk: basic
Object Caching 321/346 objects using disk: basic

Served from: toxicsoftware.com @ 2012-02-08 13:28:51 -->
