change for more appropriate avm parsing

This commit is contained in:
John Bintz 2011-03-22 18:27:11 -04:00
parent 20391fc842
commit 9cc86289e1
7 changed files with 21 additions and 38 deletions

View File

@ -280,6 +280,9 @@ module AVM
AVM_SINGLES.each do |tag, field|
if node = refs[:avm].at_xpath("./avm:#{tag}")
if field == :categories
options[field] = node.text.split(";").collect(&:strip)
else
if !(list_items = node.search('.//rdf:li')).empty?
options[field] = list_items.collect(&:text)
else
@ -287,6 +290,7 @@ module AVM
end
end
end
end
PHOTOSHOP_SINGLES_FOR_METHODS.each do |tag, field|
if node = refs[:photoshop].at_xpath("./photoshop:#{tag}")

View File

@ -42,7 +42,7 @@ module AVM
document.get_refs do |refs|
AVM_SINGLES.each do |name, method|
if node = refs[:avm].at_xpath(".//avm:#{name}")
observation_parts[method] = node.text.split(',').collect(&:strip)
observation_parts[method] = node.text.split(';').collect(&:strip)
end
end
end

View File

@ -38,12 +38,7 @@
<avm:ID>ID</avm:ID>
<avm:Type>Observation</avm:Type>
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
<avm:Subject.Category>
<rdf:Bag>
<rdf:li>Category one</rdf:li>
<rdf:li>Category two</rdf:li>
</rdf:Bag>
</avm:Subject.Category>
<avm:Subject.Category>Category one; Category two</avm:Subject.Category>
<avm:Distance>
<rdf:Seq>
<rdf:li>Light years</rdf:li>

View File

@ -38,12 +38,7 @@
<avm:ID>ID</avm:ID>
<avm:Type>Observation</avm:Type>
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
<avm:Subject.Category>
<rdf:Bag>
<rdf:li>Category one</rdf:li>
<rdf:li>Category two</rdf:li>
</rdf:Bag>
</avm:Subject.Category>
<avm:Subject.Category>Category one; Category two</avm:Subject.Category>
<avm:Distance><rdf:Seq><rdf:li>Light years</rdf:li></rdf:Seq></avm:Distance>
<avm:Spatial.CoordinateFrame>ICRS</avm:Spatial.CoordinateFrame>
<avm:Spatial.Equinox>100</avm:Spatial.Equinox>

View File

@ -18,7 +18,6 @@
<rdf:li>Name two</rdf:li>
</rdf:Bag>
</dc:subject>
</rdf:Description>
<rdf:Description rdf:about=""
xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">
@ -45,12 +44,7 @@
<rdf:li>Redshift</rdf:li>
</rdf:Seq>
</avm:Distance>
<avm:Subject.Category>
<rdf:Bag>
<rdf:li>Category one</rdf:li>
<rdf:li>Category two</rdf:li>
</rdf:Bag>
</avm:Subject.Category>
<avm:Subject.Category>Category one; Category two</avm:Subject.Category>
<avm:Spatial.CoordinateFrame>ICRS</avm:Spatial.CoordinateFrame>
<avm:Spatial.Equinox>100</avm:Spatial.Equinox>
<avm:Spatial.ReferenceValue>

View File

@ -39,12 +39,7 @@
<avm:Type>Observation</avm:Type>
<avm:Image.ProductQuality>Good</avm:Image.ProductQuality>
<avm:Distance>Light years</avm:Distance>
<avm:Subject.Category>
<rdf:Bag>
<rdf:li>Category one</rdf:li>
<rdf:li>Category two</rdf:li>
</rdf:Bag>
</avm:Subject.Category>
<avm:Subject.Category>Category one; Category two</avm:Subject.Category>
<avm:Spatial.CoordinateFrame>ICRS</avm:Spatial.CoordinateFrame>
<avm:Spatial.Equinox>100</avm:Spatial.Equinox>
<avm:Spatial.ReferenceValue>

View File

@ -2,15 +2,15 @@
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about=""
xmlns:avm="http://www.communicatingastronomy.org/avm/1.0/">
<avm:Facility>HST,Chandra</avm:Facility>
<avm:Instrument>ACS,X-Ray</avm:Instrument>
<avm:Spectral.ColorAssignment>Blue,Green</avm:Spectral.ColorAssignment>
<avm:Spectral.Band>em.opt,em.x-ray</avm:Spectral.Band>
<avm:Spectral.Bandpass>B,C</avm:Spectral.Bandpass>
<avm:Spectral.CentralWavelength>2.5,-</avm:Spectral.CentralWavelength>
<avm:Temporal.StartTime>2010-01-01T00:00,2010-01-02</avm:Temporal.StartTime>
<avm:Temporal.IntegrationTime>300,400</avm:Temporal.IntegrationTime>
<avm:DatasetID>12345,23456</avm:DatasetID>
<avm:Facility>HST;Chandra</avm:Facility>
<avm:Instrument>ACS;X-Ray</avm:Instrument>
<avm:Spectral.ColorAssignment>Blue;Green</avm:Spectral.ColorAssignment>
<avm:Spectral.Band>em.opt;em.x-ray</avm:Spectral.Band>
<avm:Spectral.Bandpass>B;C</avm:Spectral.Bandpass>
<avm:Spectral.CentralWavelength>2.5;-</avm:Spectral.CentralWavelength>
<avm:Temporal.StartTime>2010-01-01T00:00;2010-01-02</avm:Temporal.StartTime>
<avm:Temporal.IntegrationTime>300;400</avm:Temporal.IntegrationTime>
<avm:DatasetID>12345;23456</avm:DatasetID>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>