xml page 3 - Dave's Blog

Search
My timeline on Mastodon

URI Fragment Info Roundup

2008 Apr 21, 11:53

['Neverending story' by Alexandre Duret-Lutz. A framed photo of books with the droste effect applied. Licensed under creative commons.]Information about URI Fragments, the portion of URIs that follow the '#' at the end and that are used to navigate within a document, is scattered throughout various documents which I usually have to hunt down. Instead I'll link to them all here.

Definitions. Fragments are defined in the URI RFC which states that they're used to identify a secondary resource that is related to the primary resource identified by the URI as a subset of the primary, a view of the primary, or some other resource described by the primary. The interpretation of a fragment is based on the mime type of the primary resource. Tim Berners-Lee notes that determining fragment meaning from mime type is a problem because a single URI may contain a single fragment, however over HTTP a single URI can result in the same logical resource represented in different mime types. So there's one fragment but multiple mime types and so multiple interpretations of the one fragment. The URI RFC says that if an author has a single resource available in multiple mime types then the author must ensure that the various representations of a single resource must all resolve fragments to the same logical secondary resource. Depending on which mime types you're dealing with this is either not easy or not possible.

HTTP. In HTTP when URIs are used, the fragment is not included. The General Syntax section of the HTTP standard says it uses the definitions of 'URI-reference' (which includes the fragment), 'absoluteURI', and 'relativeURI' (which don't include the fragment) from the URI RFC. However, the 'URI-reference' term doesn't actually appear in the BNF for the protocol. Accordingly the headers like 'Request-URI', 'Content-Location', 'Location', and 'Referer' which include URIs are defined with 'absoluteURI' or 'relativeURI' and don't include the fragment. This is in keeping with the original fragment definition which says that the fragment is used as a view of the original resource and consequently only needed for resolution on the client. Additionally, the URI RFC explicitly notes that not including the fragment is a privacy feature such that page authors won't be able to stop clients from viewing whatever fragments the client chooses. This seems like an odd claim given that if the author wanted to selectively restrict access to portions of documents there are other options for them like breaking out the parts of a single resource to which the author wishes to restrict access into separate resources.

HTML. In HTML, the HTML mime type RFC defines HTML's fragment use which consists of fragments referring to elements with a corresponding 'id' attribute or one of a particular set of elements with a corresponding 'name' attribute. The HTML spec discusses fragment use additionally noting that the names and ids must be unique in the document and that they must consist of only US-ASCII characters. The ID and NAME attributes are further restricted in section 6 to only consist of alphanumerics, the hyphen, period, colon, and underscore. This is a subset of the characters allowed in the URI fragment so no encoding is discussed since technically its not needed. However, practically speaking, browsers like FireFox and Internet Explorer allow for names and ids containing characters outside of the defined set including characters that must be percent-encoded to appear in a URI fragment. The interpretation of percent-encoded characters in fragments for HTML documents is not consistent across browsers (or in some cases within the same browser) especially for the percent-encoded percent.

Text. Text/plain recently got a fragment definition that allows fragments to refer to particular lines or characters within a text document. The scheme no longer includes regular expressions, which disappointed me at first, but in retrospect is probably good idea for increasing the adoption of this fragment scheme and for avoiding the potential for ubiquitous DoS via regex. One of the authors also notes this on his blog. I look forward to the day when this scheme is widely implemented.

XML. XML has the XPointer framework to define its fragment structure as noted by the XML mime type definition. XPointer consists of a general scheme that contains subschemes that identify a subset of an XML document. Its too bad such a thing wasn't adopted for URI fragments in general to solve the problem of a single resource with multiple mime type representations. I wrote more about XPointer when I worked on hacking XPointer into IE.

SVG and MPEG. Through the Media Fragments Working Group I found a couple more fragment scheme definitions. SVG's fragment scheme is defined in the SVG documentation and looks similar to XML's. MPEG has one defined but I could only find it as an ISO document "Text of ISO/IEC FCD 21000-17 MPEG-12 FID" and not as an RFC which is a little disturbing.

AJAX. AJAX websites have used fragments as an escape hatch for two issues that I've seen. The first is getting a unique URL for versions of a page that are produced on the client by script. The fragment may be changed by script without forcing the page to reload. This goes outside the rules of the standards by using HTML fragments in a fashion not called out by the HTML spec. but it does seem to be inline with the spirit of the fragment in that it is a subview of the original resource and interpretted client side. The other hack-ier use of the fragment in AJAX is for cross domain communication. The basic idea is that different frames or windows may not communicate in normal fashions if they have different domains but they can view each other's URLs and accordingly can change their own fragments in order to send a message out to those who know where to look. IMO this is not inline with the spirit of the fragment but is rather a cool hack.

PermalinkCommentsxml text ajax technical url boring uri fragment rfc

Fragment Identification of MPEG Resources (Text of ISO/IEC FCD 21000-17 MPEG-21 FID)

2008 Apr 16, 7:09Standard describing URI fragments identifying parts of MPEG videos. Very similar syntax to XML fragments. Having trouble finding this document as anything other than a Word doc. Looks to exist only as an ISO standard.PermalinkCommentsstandard fragment uri video mpeg reference iso

Search and Archive of Dave's Things

2008 Apr 7, 10:31

Photo of crates in a warehouse. Licensed under creative commons by Don Jones.I now have search and an archive available for my site. I previously tried to setup crappy search by cheating using Yahoo Pipes and now instead I have a slightly less crappy search that works over all of the content that I've produced on my blog, uploaded to flickr or youtube, or added to delicious.

You can now read my first LiveJournal blog post or, for probably much more entertainment value, view all the photos and videos of Cadbury by searching for 'bunny'.

The search is only slightly less lame because although it searches over all my content, I still implemented it myself rather than getting a professional package. Also, the feed supports the same search and archive as my homepage so you can subscribe to a feed of Cadbury if you're so inclined and just skip all this other boring stuff. My homepage and feed implement the OpenSearch response elements and I've got an OpenSearch search provider (source) as well.

PermalinkCommentstechnical search archive opensearch homepage

del.icio.us API Backup

2008 Apr 3, 9:22Del.icio.us API allows you to get an XML file of all your links.PermalinkCommentsapi delicious backup xml url

Gmail integration with Internet Explorer 8

2008 Apr 3, 9:00

Internet Explorer LogoGmail Logo licensed under CC by Victor de la FuenteWith the new features of IE8 there's several easy ways to integrate Gmail, Google's web mail service, for mail composition, searching, and monitoring that I enjoy using.

Composition
I made a Send via Gmail activity that allows you to select some text, a document, or link and via the activity menu open a new tab to compose a new message with the selection. Go to my activity page and click "Send via Gmail" (source) to install it. I found info on the gmail composition URL in the comments of this gmail howto article and used that in the activity. I talked about activities previously.
Search
I've made a search provider that searches your gmail account. See my search provider page and select 'Gmail' (source) to install the Gmail search provider. Search providers aren't new to IE8 but this fits in with Gmail integration in IE. Again in the comments of another howto I found information on a Gmail search URL.
Monitor
New to IE8 is authenticated feed support and favorites bar monitoring which combined with the Gmail inbox feed means you can see when you get new mail in your favorites bar in IE. To do this, navigate to the feed https://mail.google.com/mail/feed/atom, click 'Subscribe to this feed', then click on the Add button in the upper left (the star with plus icon) and select 'Monitor on Favorites Bar' to add this as a monitored item in the favorites bar. Next, right click on the new item in your favorites bar, open the properties dialog, and enter your Gmail username and password into the new username and password fields. Now when you get new mail the Gmail feed item will shine and bold and you'll be able to get to new messages in the dropdown. I described monitored feed items previously.
PermalinkCommentsactivity gmail search howto google ie feed rss opensearch

Flickr Api Explorer - flickr.people.getPublicPhotos

2008 Apr 3, 3:43How to get the public photos of a user via the Flickr API. Flickr's API explorer is just wonderful.PermalinkCommentsflickr api documentation reference programming xml photo

Extensible Markup Language (XML) 1.1 (Second Edition)

2008 Mar 18, 11:21End-of-line handling in XML. Spoiler: XML processor should normalize most newline character sequences to 0xA.PermalinkCommentsxml spec standard w3c unicode charset newline end-of-line

MathML to VML/SVG via XSLT (Chris Pollett > Students > Namon)

2008 Mar 8, 11:23"Translating a fragment of MathMLPurpose: To get the MathML matrix related, apply, minus, times, divide, and eq tags to translate to VML and to SVG via XSLT."PermalinkCommentsNamon-Nuttayasakul mathml vml svg xslt xml convert

Internet Explorer 8 Beta 1 Released with Activities

2008 Mar 5, 11:36

Internet Explorer 8 Beta 1 is available now. I can finally talk about some of the stuff I've been working on for the past year or so: activities. Activities let you select a document, some text on a document, or a link to a document and run that selection through a web service. For example, you could select a word on a webpage and look it up in Wikipedia, select an address and map it on Yahoo Maps, select a webpage and translate it into English with Windows Live Translator, or select a link and add it to Digg.

IE8 comes installed with some activities based on Microsoft web services but there's a page you can go to to install other activities. However, that page is missing some of my favorites that I use all the time, like del.icio.us. Accordingly, I've put together a page of the activities I use. MSDN has all the info on creating Activities.

Activities are very similar to other existing features in other browsers including the ability to add context menu items to IE. There's two important differences which make activities better. Activities have a preview window that pops out when you hover over an activity, which is useful to get in place information easily provided by developers. The other is that the interface is explicit and takes after HTML FORMs and OpenSearch descriptions. Because the interface is explicitly described in XML (unlike the context menu additions described above which run arbitrary script) we have the ability to use activities in places other than on a webpage in the future. And because activity definitions are similar to HTML FORMs, if your webservice has an HTML FORM describing it you can easily create an activity.

PermalinkCommentsmicrosoft technical activity openservice ie8 ie activities msdn

GML | GeoRSS :: Geographically Encoded Objects for RSS feeds

2008 Mar 4, 12:27A description of GeoRSS: "Geography Markup Language (GML) is an XML grammar written in XML Schema for the modelling, transport, and storage of geographic information"PermalinkCommentsgeorss rss feed atom geo reference standards xml

Chumby will be cool, despite its name

2008 Feb 19, 1:51

Bedside ChumbyI signed up for the pre-release beta and purchased a Chumby last year. Chumby looks like a cousin to a GPS unit. Its similar in size with a touch screen, but has WiFi, accelerometers, and is pillow like on the sides that aren't a screen. In practice its like an Internet alarm clock that shows you photos and videos off the Web. Its hackable in that Chumby Industries tells you about the various ways to run your own stuff on the Chumby, modifying the boot sequence (it runs Linux), turning on sshd, etc, etc. The Chumby forum too has lots of info from folks who have found interesting hacks for the device.

When you turn on the Chumby it downloads and runs the latest version of the Chumby software which lets you set alarms, play music, and display Flash widgets. The Chumby website lets anyone upload their own Flash widgets to share with the community. I tried my hand at creating one using Adobe's free Flash creation SDK but I don't know Flash and didn't have the patience to learn.

Currently my Chumby is set to wake me up at 8am on weekdays with music from ShoutCast and then displays traffic and weather. At 10am everyday it switches to showing me a slide-show of LolCats. At 11pm it switches to night mode where it displays the time in dark grey text on a black background at a reduced light level so as not to disturb me while I sleep.

I like the Chumby but I have two complaints. The first is that it forces me to learn flash in order to create anything cool rather than having a built-in Web browser or depending on a more Web friendly technology. The second complaint is about its name. At first I thought the name was stupid in a kind of silly way, but now that I'm used to the name it sounds vaguely dirty.

PermalinkCommentschumby review flash linux

Flickr Services: Flickr API: flickr.photos.getInfo

2008 Feb 12, 3:01How to obtain the info that goes into the photo source URIs: via the flickr.photos.getInfo API.PermalinkCommentsflickr reference api xml

Flickr Services

2008 Feb 12, 3:00Flickr's URI format for obtaining the actual photos.PermalinkCommentsflickr api reference uri xml

Web Q&A: XPath, XML Notepad, Data Islands, Case Sensitivity, XSL, and More -- MSDN Magazine, September 2001

2008 Feb 7, 2:36To summ up the last Q&A, the one I was interested in: "Is there any way to escape the characters " and ' in an XPath expression...". And their answer is no. Lame. I thought XPath folk would have defined this.PermalinkCommentsmicrosoft msdn xpath xml article

Reusing Internet Explorer's Builtin CSS

2008 Jan 29, 9:32

When throwing together an HTML page at work that other people will view, I stick the following line in for style. Its IE's error page CSS and contaits a subtle gradient background that I like.

This uses the res URI scheme. You can see the other interesting IE resources using my resource list tool.PermalinkCommentsresource technical css internet-explorer ie res

Windows Media Center and Zune Integration Hack

2007 Nov 28, 1:23One of the new Zune features that had me the most excited was the claimed improved Windows Media Center integration which unfortunately turned out to simply mean support for the Win MCE video format (with an exception for HD). I wanted to be able to pick shows recorded by my Win MCE and have the Zune automatically sync up the latest episodes. However, with the improved podcast support in the Zune software one can easily create a ridiculous hack to accomplish this.

The new Zune software has podcast support which does everything I'd want to do with a Win MCE recorded TV series so the goal is to shoehorn a TV series into a Zune podcast. An overview of the steps: Create an XSLT that converts Win MCE data to a podcast, run the XSLT as a scheduled task every few hours per TV series, setup a Web server pointed at the resulting podcasts and the Win MCE Recorded TV directory, and subscribe to the resulting podcasts in the Zune software.
  1. Reading through the Win MCE data stored as an XML file in "C:\ProgramData\Microsoft\eHome\Recording\Recordings.xml" and the spec for podcasts I created an XSLT to convert a series from Win MCE data to a podcast.
  2. I added a new task to the Scheduled Tasks to run my XSLT using my xsltproc.js script. The task runs a handful of commands that look something like the following:

    C:\windows\system32\wscript.exe C:\users\dave\bin\xsltproc.js C:\Users\Dave\Documents\trunk\development\mce-zune\mce-to-podcast.xslt C:\ProgramData\Microsoft\eHome\Recording\Recordings.xml --param title "The Daily Show With Jon Stewart" --param max 4 --param baseURI "http://groucho/" --param thisRelURI "tds.xml" -o "D:\recorded tv\tds.xml"

    For each TV series I run a command like the above and that outputs a podcast for that series into my "D:\Recorded TV\" directory.
  3. Zune only allows http URIs for its podcasts so I installed a web server on my Win MCE server. I'm running Vista Ultimate so it was quick and easy for me to install IIS7 but any Web server will do. Then I pointed it at "D:\Recorded TV\".
  4. Once all the above was done I just subscribed to the resulting podcasts via my Web server and viola! Since I'm forced to use a Web server I can even run the Zune software on a machine other than my Win MCE server. You can see a screen-shot above of my Zune software showing my Colbert Report podcast.
PermalinkCommentstechnical xml mce hack windows media center zune windows xslt podcast

Zune.net's User Card Service

2007 Nov 19, 4:15Replace the zunetag parameter in the URI with the desired Zune username to find the user's Zune social data such as Favorites, Recent Tracks, etc.PermalinkCommentszune microsoft xml

Zune Software Update

2007 Nov 19, 3:47I really appreciate that the first gen Zune's get the new Zune's firmware and software. I like the updated Zune software personally because its faster and simpler, has better podcast support, and the whole social thing has is on their website now. So, I guess I like the software because it has new features that should have been there in the first place.

The social thing is like a Zune social network. It uses your Xbox Live friends to seed your Zune friends list, lets you do the expected social network stuff, lets you preview songs, and unlike first gen Zunes which required face to face time with other Zune owners, allows you to send songs to people. It also lets you display your recently played tracks and your favorite tracks, similar to what Last.FM has, via a Zune Card. I like the Zune Card from a technical perspective because it separates the Zune Card view, written in flash from the User Card data which is in XML. I hope they intend to keep the XML available via this UserCard Service because I think there's potential to easily do cool things.PermalinkCommentsmicrosoft technical music zune social

FoaF on my Homepage

2007 Oct 14, 3:12I've updated my homepage by moving stuff about me onto a separate About page. Creating the About page was the perfect opportunity to get FoaF, a machine readable way of describing yourself and your friends, off my to do list. I have a base FoaF file to which I add friends, projects, and accounts from delicious using an XSLT. This produces the FoaF XML resource on which I use another XSLT to convert into HTML and produce the About page.

I should also mention a few FoaF pages I found useful in doing this: PermalinkCommentstechnical xml foaf personal xslt xsl homepage

XSL Identity Transfom

2007 Oct 12, 4:08As noted in the XSL Transformations spec you can create the identity transform using the xsl:copy element. With the MSXML implementation of xsl:copy the example the spec gives produces slightly ugly elements. For instance given it produces . In order to ensure empty elements turn out pretty I've modified the example as follows:
    
        
            
                
                    
                
            
            
                
                    
                
            
        
    

This got me thinking about inverting XSLTs. Clearly in general an XSLT isn't invertible since an XSLT can completely ignore the input XML and produce something else entirely but then the above is an example of an XSLT that is invertible. So there is a subset of XSLTs that are invertible, how might you produce the inverse of an XSLT, and would this ever be useful?PermalinkCommentsxml msxml inverse xlst xsl
Older EntriesNewer Entries Creative Commons License Some rights reserved.