Module: XSD::XMLParser

Defined in:
lib/xsd/xmlparser.rb,
lib/xsd/xmlparser/parser.rb,
lib/xsd/xmlparser/xmlparser.rb,
lib/xsd/xmlparser/xmlscanner.rb,
lib/xsd/xmlparser/rexmlparser.rb

Defined Under Namespace

Classes: Parser, REXMLParser, XMLParser, XMLScanner

Constant Summary collapse

NSParseRegexp =

$1 is necessary.

Regexp.new('^xmlns:?(.*)$')

Instance Method Summary collapse

Instance Method Details

#create_parser(host, opt) ⇒ Object



16
17
18
# File 'lib/xsd/xmlparser.rb', line 16

def create_parser(host, opt)
  XSD::XMLParser::Parser.create_parser(host, opt)
end

#filter_ns(ns, attrs) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/xsd/xmlparser.rb', line 24

def filter_ns(ns, attrs)
  return attrs if attrs.nil? or attrs.empty?
  newattrs = {}
  attrs.each do |key, value|
    if (NSParseRegexp =~ key)
	# '' means 'default namespace'.
	tag = $1 || ''
	ns.assign(value, tag)
    else
	newattrs[key] = value
    end
  end
  newattrs
end