• Home
  • RSS Feed
  • Log in


If it looks like XML…
Posted by Jeroen van Erp in the early morning: August 17th, 2007

And walks and talks like XML, it surely must be XML. Yes, well how wrong you can be about assumptions is once more shown in this blog.

One of our clients has an application through which videos are streamed. They do this by providing a browser embedded player, or your stand-alone Windows Media Player with an ASX file. The ASX file tends to look like this:


  
    
  

So far so good. As long as that “video.wmv” exists, it will be played correctly by the Windows Media Player. Our client however requested that we add metadata from a database to the ASX file, so that when it is played in your stand-alone Windows Media Player, you will see the title, author and publication date of the video and a logo of the company. The problem however was that we don’t generate these ASX files, they exist on the streaming server. This meant that we needed to read the ASX files on the fly, change them and send the response to the requesting client.

Because of the format we decided to use Dom4J to parse the XML and create a DOM tree of the ASX. We then added nodes to the DOM document, and wrote the resulting XML to the response stream. The XML which was the result of this exercise looked like the following:



  
    00:00:10.00
    
  
  
    Title of the video
    Xebia
    2007-08-17
    
  

This is valid XML. But all of a sudden, the videos didn’t play anymore in Windows Media Player. After re-checking each of the tags carefully with the ASX Elements Reference on MSDN, we couldn’t find what was wrong with this ASX file. That was, until we read the following statement here:

“… The first four characters of an ASX file must be <ASX. …”

Wait a minute, that means it is XML, but you cannot include the XML preamble?!… After discarding the preamble from the result XML, the file suddenly worked again, and the video was streamed. The valuable lesson here of course is that If it looks, walks, talks and acts like XML, it still just might not be real XML.

Share

Tags: XML
Filed under General | 3 Comments »



3 Responses to “If it looks like XML…”



    Lars Vonk Says:
    Posted at: August 17, 2007 at 10:15 am

    As Homer would say: “Doh!”

    Reply


    Robert van Loghem Says:
    Posted at: August 17, 2007 at 10:24 am

    As if Microsoft would have it any other way! ;)

    “Embrace and Extend” eh…no in this case “Embrace and Detract”

    Reply


    Nico Says:
    Posted at: August 17, 2007 at 7:49 pm

    Yeah, IE does something similar, if you don’t specify the DOCTYPE on the first line in your strict xhtml webpage, IE won’t recognize, however to be strict xhtml you have to specify the XML preamble on the first line…

    Reply


Leave a Reply

Click here to cancel reply.


Xebia Sites

  • Xebia Corporate
  • Xebia France
  • Xebia India
  • XebiCon 2012

Categories

  • Java (312)
  • Agile (192)
  • General (141)
  • Scrum (70)
  • Testing (65)
  • Architecture (65)
  • Performance (47)
  • Middleware (59)
    • Deployment (40)
  • Xebia Labs (41)
  • SOA (31)
  • Project Management (31)
  • Podcast (31)
  • Tools (28)
  • Uncategorized (24)
  • lean architecture (20)
  • Quality Assurance (19)
  • Articles (15)
  • Requirements Management (14)
  • Virtualization (21)

Tag Cloud

    Oracle JPA implementation patterns Spring Java SOA Javascript Maven lean architectuur Flex Moving to India Hibernate Agile Eclipse Groovy Lean Frameworks Scala product owner JPA Ajax Xebia ACT Concurrency Control TDD Scrum Grails lean architecture XML Architecture agile architectuur

Archives

  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
Avatars by Sterling Adventures