title: xpath attribute of root node
body: <p>I wan to fetch the ID, LASTEDITED, EXPIRESS attributes in the root element. I am using xpath, ruby and nokogiri. But it dosent work, any ideas? </p>
  
  <p>xPath querys: </p>
  
  <pre><code>  doc.xpath('/educationProvider/@id').each do |id_node| 
      puts node.content
    end
  
    doc.xpath('/educationProvider/@lastEdited').each do |lastedited_node|
      puts lastedited_node.content
    end
  
    doc.xpath('/educationProvider/@expires').each do |expires_node|
      puts expires_node.content
    end
  </code></pre>
  
  <p>This how my XML looks like:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;p:educationProvider xmlns:p="http://skolverket.se/education/provider/1.0" xmlns="http://skolverket.se/education/commontypes/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expires="2015-01-31" id="provider.uh.msb" lastEdited="2012-11-01T12:51:37" xsi:schemaLocation="http://skolverket.se/education/provider/1.0 educationProvider.xsd"&gt;
          &lt;p:vCard&gt;
              &lt;VERSION/&gt; 
              &lt;FN/&gt; 
              &lt;N/&gt; 
              &lt;ADR&gt;
                  &lt;LOCALITY&gt;KARLSTAD&lt;/LOCALITY&gt; 
                  &lt;PCODE&gt;651 81&lt;/PCODE&gt; 
              &lt;/ADR&gt;
              &lt;TEL&gt;
                  &lt;NUMBER&gt;0771-240240&lt;/NUMBER&gt; 
              &lt;/TEL&gt;
              &lt;EMAIL&gt;
                  &lt;USERID&gt;utbildning@msbmyndigheten.se&lt;/USERID&gt; 
              &lt;/EMAIL&gt;
              &lt;ORG&gt;
                  &lt;ORGNAME&gt;Myndigheten för samhällsskydd och beredskap&lt;/ORGNAME&gt; 
              &lt;/ORG&gt;
              &lt;URL&gt;http://www.msbmyndigheten.se&lt;/URL&gt;
          &lt;/p:vCard&gt;
      &lt;/p:educationProvider&gt;
  </code></pre>
  
  <p>HERE IS MY RUBY-SCRIPT:</p>
  
  <pre><code>require 'rubygems'
  require 'nokogiri'
  require 'open-uri'
  
  # parse the HTML document with all the links to the XML files.
  doc = Nokogiri::HTML(open('http://testnavet.skolverket.se/SusaNavExport/EmilExporter?GetEvent&amp;EMILVersion=1.1&amp;NotExpired&amp;EIAcademicType=UoH&amp;SelectEP'))
  # URLS - array
  @urls = Array.new 
  #Get all XML-urls and save them in urls-array
  doc.xpath('//a/@href').each do |links|
    @urls &lt;&lt; links.content
  end
  
  @id = Array.new
  @lastedited = Array.new
  @expires = Array.new
  
  # loop all the url of the XML files
  @urls.each do |url|
    doc = Nokogiri::HTML(open(url))
    # grab the content I want
    doc.xpath('/educationProvider/@id').each do |id_node| 
      id_node.content
    end
  
    doc.xpath('/educationProvider/@lastEdited').each do |lastedited_node|
      @lastedited &lt;&lt; lastedited_node.content
    end
  
    doc.xpath('/educationProvider/@expires').each do |expires_node|
      @expires &lt;&lt; expires_node.content
    end
  end
  
  #print it out
  (0..@id.length - 1).each do |index|
    puts "ID: #{@id[index]}"
    puts "Lastedited: #{@lastedited[index]}"
    puts "Expiress: #{@expires[index]}"
  end
  </code></pre>