parseXML explained

parseXML explained

All examples show pretty much the same code but without much explanation, could someone explain what each line is doing?

I put in the comments my own interpretation but I would really like a confirmation:

  1.      
    var xml = "<rss version='2.0'><channel><title>RSS Title</title></channel></rss>";

  2. // parseXML will parse the string to an Object, or as the docs put it:
  3. // "parseXMLuses the native parsing function of the browser to create a valid XML Document."
  4. // from what I cam see, this is already an object
  5. var xmlDoc = $.parseXML( xml );

  6. // I guess the next step is also described in the docs, is this casting?
  7. // "This document can then be passed to jQuery to create a typical jQuery object that can be traversed and manipulated"
  8. // not sure what happens when you pass it to jquery...?
  9. var $xml = $( xmlDoc );

  10. // this is fine, I guess now we have a traversable object
  11. var $title = $xml.find( "title" );