У меня есть этот XML:
<RECEIPT receiptDate="2012-02-10T12:46:26.661Z" submissionFile="E.coli_ENT_WS.submission.xml" success="false">
<EXPERIMENT alias="ENT 23" status="PUBLIC"/>
<EXPERIMENT alias="WS 23" status="PUBLIC"/>
<RUN alias="ENT 23" status="PUBLIC"/>
<RUN alias="WS 23" status="PUBLIC"/><
SAMPLE alias="ENT 23" status="PUBLIC"/>
<SAMPLE alias="WS 23" status="PUBLIC"/>
<STUDY alias="ENT 23" status="PUBLIC"/>
<STUDY alias="WS 23" status="PUBLIC"/>
<SUBMISSION alias="E.coli_ENT_WS"/>
<MESSAGES>
<ERROR> In run(ENT 23), the FC018_s_6_sequence_L70.txt.md5 not found </ERROR>
<ERROR> In run(ENT 23) found the file format(Illumina_native_fastq), but requires SPOT_DESCRIPTOR information in the experiment(ENT 23)</ERROR>
<ERROR>The Illumina_native_fastq file format required gzip compression for submission.</ERROR>
<ERROR> FILE attribute quality_scoring_system is required</ERROR>
<ERROR>Same file FC018_s_6_sequence_L70.txt found in Run(WS 23) has been used with other Run</ERROR>
<ERROR> In run(WS 23), the FC018_s_6_sequence_L70.txt.md5 not found </ERROR>
<ERROR> In run(WS 23) found the file format(Illumina_native_fastq), but requires SPOT_DESCRIPTOR information in the experiment(WS 23)</ERROR>
<ERROR>The Illumina_native_fastq file format required gzip compression for submission.</ERROR>
<ERROR> FILE attribute quality_scoring_system is required</ERROR>
<INFO> VALIDATE action for the following XML: E.coli_ENT_WS.study.xml E.coli_ENT_WS.sample.xml E.coli_ENT_WS.experiment.xml E.coli_ENT_WS.run.xml </INFO>
<INFO>Inform_on_error is not filled in; auto populated from Submission account. </INFO>
<INFO>Number of files in drop box = 2 & Number of files in Submission = 1</INFO>
<INFO>Deprecated element ignored: CENTER_NAME</INFO>
<INFO>Deprecated element PROJECT_ID converted to RELATED_STUDY</INFO>
<INFO>Deprecated element ignored: CENTER_NAME</INFO>
<INFO>Deprecated element PROJECT_ID converted to RELATED_STUDY</INFO>
<INFO> SPOT_DESCRIPTOR is missing</INFO><INFO> SPOT_DESCRIPTOR is missing</INFO>
<INFO>Experiment (ENT 23) SPOTDESCRIPTOR is optional is null</INFO>
<INFO>Experiment (WS 23) SPOTDESCRIPTOR is optional is null</INFO>
<INFO> In run(ENT 23) file name (FC018_s_6_sequence_L70.txt) mentioned is not found among the submitted files</INFO>
<INFO> In run(WS 23) file name (FC018_s_6_sequence_L70.txt) mentioned is not found among the submitted files</INFO>
</MESSAGES>
<ACTIONS>VALIDATE</ACTIONS>
<ACTIONS>VALIDATE</ACTIONS>
<ACTIONS>VALIDATE</ACTIONS>
<ACTIONS>VALIDATE</ACTIONS>
<ACTIONS>HOLD</ACTIONS>
</RECEIPT>
Я могу получить все теги элементов в основном EXPERIMENT
, ERROR
, INFO
, ACTION
, MESSAGE
.
То, что я хотел бы получить, это атрибуты таких элементов, как EXPERIMENT
и RECEIPT
Я использую Nokogiri для моего анализа.
Мой код такой:
@req_test = %x[curl -F "SUBMISSION=@xml/#{@experiment.alias}.submission.xml" -F "STUDY=@xml/#{@experiment.alias}.study.xml" -F "SAMPLE=@xml/#{@experiment.alias}.sample.xml" -F "RUN=@xml/#{@experiment.alias}.run.xml" -F "EXPERIMENT=@xml/#{@experiment.alias}.experiment.xml" https://www-test.ebi.ac.uk/ena/submit/drop-box/submit/]
@doc = Nokogiri::XML(@req_test)
# collecting all the errors
@expt = @doc.xpath("//ERROR")
# Collecting all the INFO
@info = @doc.xpath("//INFO")
Это был мой контролер.My View - это просто что-то для отображения:
<h3>This is the ERRORS Collected</h3>
<% for expt in @expt %>
<ul>
<li><%= expt %><br \></li>
</ul>
<% end %>
<br \ >
<h3>This is the INFO Collected</h3>
<% for info in @info %>
<ul>
<li><%= info %><br \></li>
</ul>
<% end %>
и приложение отображает что-то вроде этого:
This is the ERRORS Collected
In run(ENT 23), the FC018_s_6_sequence_L70.txt.md5 not found
In run(ENT 23) found the file format(Illumina_native_fastq), but requires SPOT_DESCRIPTOR information in the experiment(ENT 23)
The Illumina_native_fastq file format required gzip compression for submission.
FILE attribute quality_scoring_system is required
Same file FC018_s_6_sequence_L70.txt found in Run(WS 23) has been used with other Run
In run(WS 23), the FC018_s_6_sequence_L70.txt.md5 not found
In run(WS 23) found the file format(Illumina_native_fastq), but requires SPOT_DESCRIPTOR information in the experiment(WS 23)
The Illumina_native_fastq file format required gzip compression for submission.
FILE attribute quality_scoring_system is required
This is the INFO Collected
VALIDATE action for the following XML: E.coli_ENT_WS.study.xml E.coli_ENT_WS.sample.xml E.coli_ENT_WS.experiment.xml E.coli_ENT_WS.run.xml
Inform_on_error is not filled in; auto populated from Submission account.
Number of files in drop box = 2 & Number of files in Submission = 1
Deprecated element ignored: CENTER_NAME
Deprecated element PROJECT_ID converted to RELATED_STUDY
Deprecated element ignored: CENTER_NAME
Deprecated element PROJECT_ID converted to RELATED_STUDY
SPOT_DESCRIPTOR is missing
SPOT_DESCRIPTOR is missing
Experiment (ENT 23) SPOTDESCRIPTOR is optional is null
Experiment (WS 23) SPOTDESCRIPTOR is optional is null
In run(ENT 23) file name (FC018_s_6_sequence_L70.txt) mentioned is not found among the submitted files
In run(WS 23) file name (FC018_s_6_sequence_L70.txt) mentioned is not found among the submitted files
Пожалуйста, кто-нибудь может предложить метод / опцию получения.