Class: XMLScan::XMLNamespaceDecoration::NamespaceDeclaration

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/xmlscan/namespace.rb

Instance Method Summary collapse

Methods included from Visitor

#on_attribute, #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

Constructor Details

#initialize(parent) ⇒ NamespaceDeclaration

Returns a new instance of NamespaceDeclaration.



175
176
177
# File 'lib/xmlscan/namespace.rb', line 175

def initialize(parent)
  @parent = parent
end

Instance Method Details

#on_attr_charref(code, *a) ⇒ Object



193
194
195
# File 'lib/xmlscan/namespace.rb', line 193

def on_attr_charref(code, *a)
  @nsdecl << [code].pack('U')
end

#on_attr_charref_hex(code, *a) ⇒ Object



197
198
199
# File 'lib/xmlscan/namespace.rb', line 197

def on_attr_charref_hex(code, *a)
  @nsdecl << [code].pack('U')
end

#on_attr_entityref(ref, *a) ⇒ Object



188
189
190
191
# File 'lib/xmlscan/namespace.rb', line 188

def on_attr_entityref(ref, *a)
  @parent.ns_wellformed_error \
    "xmlns includes undeclared entity reference"
end

#on_attr_value(str, *a) ⇒ Object



184
185
186
# File 'lib/xmlscan/namespace.rb', line 184

def on_attr_value(str, *a)
  @nsdecl << str
end

#on_attribute_end(name, *a) ⇒ Object



201
202
203
# File 'lib/xmlscan/namespace.rb', line 201

def on_attribute_end(name, *a)
  @parent.on_xmlns_end @prefix, @nsdecl
end

#on_xmlns_start(prefix, *a) ⇒ Object



179
180
181
182
# File 'lib/xmlscan/namespace.rb', line 179

def on_xmlns_start(prefix, *a)
  @prefix = prefix
  @nsdecl = ''
end