Class: Canon::Xml::Sax::Probe
- Inherits:
-
Object
- Object
- Canon::Xml::Sax::Probe
- Defined in:
- lib/canon/xml/sax/probe.rb
Overview
Tree-free scan stand-in for the builder protocol. Records recover errors and accumulates an attribute-name-order signature (element open/close tokens plus each non-xmlns attribute name in document order); content itself is ignored — the digest gate covers it. The verbose lane compares the two sides' signatures to prove the absence of the two digest-invisible report entries: informative attribute-order DiffNodes and the SAX-lane parse-error banner (issue #130).
Instance Attribute Summary collapse
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Instance Method Summary collapse
-
#cdata(_string) ⇒ Object
The builder protocol the SAX drivers forward to is
cdata(MoxmlDriver#on_cdata and NokogiriDriver#cdata_block both call builder.cdata); the nokogiri-style name here made every CDATA-bearing probe raise NoMethodError under the flipped leptris SAX engine. - #characters(_string) ⇒ Object
- #comment(_string) ⇒ Object
- #end_element(_name) ⇒ Object
- #error(_string) ⇒ Object
-
#initialize ⇒ Probe
constructor
A new instance of Probe.
- #processing_instruction(_name, _content) ⇒ Object
- #saw_error? ⇒ Boolean
- #start_element(name, attrs = []) ⇒ Object
- #warning(_string) ⇒ Object
Constructor Details
#initialize ⇒ Probe
Returns a new instance of Probe.
17 18 19 20 |
# File 'lib/canon/xml/sax/probe.rb', line 17 def initialize @saw_error = false @signature = +"" end |
Instance Attribute Details
#signature ⇒ Object (readonly)
Returns the value of attribute signature.
15 16 17 |
# File 'lib/canon/xml/sax/probe.rb', line 15 def signature @signature end |
Instance Method Details
#cdata(_string) ⇒ Object
The builder protocol the SAX drivers forward to is cdata
(MoxmlDriver#on_cdata and NokogiriDriver#cdata_block both call
builder.cdata); the nokogiri-style name here made every
CDATA-bearing probe raise NoMethodError under the flipped
leptris SAX engine.
53 |
# File 'lib/canon/xml/sax/probe.rb', line 53 def cdata(_string); end |
#characters(_string) ⇒ Object
46 |
# File 'lib/canon/xml/sax/probe.rb', line 46 def characters(_string); end |
#comment(_string) ⇒ Object
55 |
# File 'lib/canon/xml/sax/probe.rb', line 55 def comment(_string); end |
#end_element(_name) ⇒ Object
42 43 44 |
# File 'lib/canon/xml/sax/probe.rb', line 42 def end_element(_name) @signature << "\\" end |
#error(_string) ⇒ Object
26 27 28 |
# File 'lib/canon/xml/sax/probe.rb', line 26 def error(_string) @saw_error = true end |
#processing_instruction(_name, _content) ⇒ Object
57 |
# File 'lib/canon/xml/sax/probe.rb', line 57 def processing_instruction(_name, _content); end |
#saw_error? ⇒ Boolean
22 23 24 |
# File 'lib/canon/xml/sax/probe.rb', line 22 def saw_error? @saw_error end |
#start_element(name, attrs = []) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/canon/xml/sax/probe.rb', line 32 def start_element(name, attrs = []) @signature << "/" << name << "\0" attrs.each do |attr| attr_name = attr[0].to_s next if attr_name == "xmlns" || attr_name.start_with?("xmlns:") @signature << "@" << attr_name << "\0" end end |
#warning(_string) ⇒ Object
30 |
# File 'lib/canon/xml/sax/probe.rb', line 30 def warning(_string); end |