Module: XMLScan::NSVisitor

Includes:
Visitor
Included in:
TestVisitor
Defined in:
lib/xmlscan/namespace.rb

Instance Method Summary collapse

Methods included from Visitor

#on_attr_charref, #on_attr_charref_hex, #on_attr_entityref, #on_attr_value, #on_attribute, #on_attribute_end, #on_cdata, #on_chardata, #on_charref, #on_charref_hex, #on_comment, #on_doctype, #on_end_document, #on_entityref, #on_etag, #on_pi, #on_prolog_space, #on_stag, #on_stag_end, #on_stag_end_empty, #on_start_document, #on_xmldecl, #on_xmldecl_encoding, #on_xmldecl_end, #on_xmldecl_key, #on_xmldecl_other, #on_xmldecl_standalone, #on_xmldecl_version, #parse_error, #valid_error, #warning, #wellformed_error

Instance Method Details

#ns_parse_error(msg) ⇒ Object

Raises:



24
25
26
# File 'lib/xmlscan/namespace.rb', line 24

def ns_parse_error(msg)
  raise NSParseError.new(msg)
end

#ns_valid_error(msg) ⇒ Object

Raises:



32
33
34
# File 'lib/xmlscan/namespace.rb', line 32

def ns_valid_error(msg)
  raise NSNotValidError.new(msg)
end

#ns_wellformed_error(msg) ⇒ Object



28
29
30
# File 'lib/xmlscan/namespace.rb', line 28

def ns_wellformed_error(msg)
  raise NSNotWellFormedError.new(msg)
end

#on_attribute_ns(qname, prefix, localpart, *a) ⇒ Object



60
61
# File 'lib/xmlscan/namespace.rb', line 60

def on_attribute_ns(qname, prefix, localpart, *a)
end

#on_stag_end_empty_ns(qname, namespaces, *a) ⇒ Object



66
67
# File 'lib/xmlscan/namespace.rb', line 66

def on_stag_end_empty_ns(qname, namespaces, *a)
end

#on_stag_end_ns(qname, namespaces, *a) ⇒ Object



63
64
# File 'lib/xmlscan/namespace.rb', line 63

def on_stag_end_ns(qname, namespaces, *a)
end

#on_stag_ns(qname, prefix, localpart, *a) ⇒ Object

<foo:bar hoge:fuga=” hoge=” > <foo hoge:fuga=” hoge=” >

^       ^          ^ ^     ^  ^
1       2          3 4     5  6

The following method will be called with the following arguments
when the parser reaches the above point;

  1: on_stag_ns           ('foo:bar', 'foo', 'bar')
      or
     on_stag_ns           ('foo', '', 'foo')
  2: on_attribute_ns      ('hoge:fuga', 'hoge', 'fuga')
  3: on_attribute_end     ('hoge:fuga')
  4: on_attribute_ns      ('hoge', nil, 'hoge')
  5: on_attribute_end     ('hoge')
  6: on_stag_end_ns       ('foo:bar', { 'foo' => '', ... })
      or
     on_stag_end_empty_ns ('foo:bar', { 'foo' => '', ... })


57
58
# File 'lib/xmlscan/namespace.rb', line 57

def on_stag_ns(qname, prefix, localpart, *a)
end