Module: XSD::XMLParser
- Defined in:
- lib/xsd/xmlparser.rb,
lib/xsd/xmlparser/parser.rb,
lib/xsd/xmlparser/oxparser.rb,
lib/xsd/xmlparser/ogaparser.rb,
lib/xsd/xmlparser/rexmlparser.rb,
lib/xsd/xmlparser/libxmlparser.rb,
lib/xsd/xmlparser/nokogiriparser.rb
Defined Under Namespace
Classes: LibXMLParser, NokoDocHandler, NokogiriParser, OgaParser, OxDocHandler, OxParser, Parser, REXMLParser
Constant Summary collapse
- NSParseRegexp =
$1 is necessary.
Regexp.new('^xmlns:?(.*)$', nil)
Class Method Summary collapse
Class Method Details
.create_parser(host, opt) ⇒ Object
14 15 16 |
# File 'lib/xsd/xmlparser.rb', line 14 def create_parser(host, opt) XSD::XMLParser::Parser.create_parser(host, opt) end |
.filter_ns(ns, attrs) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/xsd/xmlparser.rb', line 22 def filter_ns(ns, attrs) ns_updated = false if attrs.nil? or attrs.empty? return [ns, attrs] end newattrs = {} attrs.each do |key, value| if NSParseRegexp =~ key unless ns_updated ns = ns.clone_ns ns_updated = true end # tag == '' means 'default namespace' # value == '' means 'no default namespace' tag = $1 || '' ns.assign(value, tag) else newattrs[key] = value end end return [ns, newattrs] end |