pauldix-sax-machine 0.0.10 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/sax-machine.rb +1 -1
- data/lib/sax-machine/sax_handler.rb +1 -0
- data/spec/sax-machine/sax_document_spec.rb +10 -0
- metadata +1 -1
data/lib/sax-machine.rb
CHANGED
@@ -30,6 +30,7 @@ module SAXMachine
|
|
30
30
|
|
31
31
|
elsif @collection_config = sax_config.collection_config(@name)
|
32
32
|
@collection_handler = @collection_config.handler
|
33
|
+
@collection_handler.start_element(@name, @attrs)
|
33
34
|
|
34
35
|
elsif @element_config = sax_config.element_config_for_attribute(@name, @attrs)
|
35
36
|
parse_element_attribute
|
@@ -280,6 +280,16 @@ describe "SAXMachine" do
|
|
280
280
|
document.entries.size.should == 1
|
281
281
|
document.entries.first.title.should == "correct title"
|
282
282
|
end
|
283
|
+
|
284
|
+
it "should parse out an attribute value from the tag that starts the collection" do
|
285
|
+
class Foo
|
286
|
+
element :entry, :value => :href, :as => :url
|
287
|
+
end
|
288
|
+
document = @klass.parse("<xml><entry href='http://pauldix.net'><title>paul</title></entry></xml>")
|
289
|
+
document.entries.size.should == 1
|
290
|
+
document.entries.first.title.should == "paul"
|
291
|
+
document.entries.first.url.should == "http://pauldix.net"
|
292
|
+
end
|
283
293
|
end
|
284
294
|
end
|
285
295
|
|