title: Trying to parse a XML using Nokogiri with Ruby
body: <p>I am new to programming so bear with me. I have an XML document that looks like this:</p>
  
  <p>File name: PRIDE1542.xml</p>
  
  <pre><code>&lt;ExperimentCollection version="2.1"&gt;
  &lt;Experiment&gt;
      &lt;ExperimentAccession&gt;1015&lt;/ExperimentAccession&gt;
      &lt;Title&gt;**Protein complexes in Saccharomyces cerevisiae (GPM06600002310)**&lt;/Title&gt;
      &lt;ShortLabel&gt;GPM06600002310&lt;/ShortLabel&gt;
      &lt;Protocol&gt;
          &lt;ProtocolName&gt;**None**&lt;/ProtocolName&gt;
      &lt;/Protocol&gt;
      &lt;mzData version="1.05" accessionNumber="1015"&gt;
          &lt;cvLookup cvLabel="RESID" fullName="RESID Database of Protein Modifications" version="0.0" address="http://www.ebi.ac.uk/RESID/" /&gt;
          &lt;cvLookup cvLabel="UNIMOD" fullName="UNIMOD Protein Modifications for Mass Spectrometry" version="0.0" address="http://www.unimod.org/" /&gt;
          &lt;description&gt;
              &lt;admin&gt;
                  &lt;sampleName&gt;**GPM06600002310**&lt;/sampleName&gt;
                  &lt;sampleDescription comment="Ho, Y., et al., Systematic identification of protein complexes in Saccharomyces cerevisiae by mass spectrometry. Nature. 2002 Jan 10;415(6868):180-3."&gt;
                      &lt;cvParam cvLabel="NEWT" accession="4932" name="Saccharomyces cerevisiae (Baker's yeast)" value="Saccharomyces cerevisiae" /&gt;
                  &lt;/sampleDescription&gt;
                              &lt;/admin&gt;
          &lt;/description&gt;
          &lt;spectrumList count="0" /&gt;
            &lt;/mzData&gt;
      &lt;/Experiment&gt;
  &lt;/ExperimentCollection&gt;
  </code></pre>
  
  <p>I want to take out the text in between <code>&lt;Title&gt;</code>, <code>&lt;ProtocolName&gt;</code>, and <code>&lt;SampleName&gt;</code> and put into a text file (I tried bolding them to making it easier to see). I have the following code so far (based on posts I saw on this site), but it seems not to work:</p>
  
  <pre><code>&gt;&gt; require 'rubygems'
  &gt;&gt; require 'nokogiri'
  &gt;&gt; doc = Nokogiri::XML(File.open("PRIDE_Exp_Complete_Ac_10094.xml"))
  &gt;&gt; @ExperimentCollection = doc.css("ExperimentCollection Title").map {|node| node.children.text }
  </code></pre>
  
  <p>Can someone help me?</p>