Sha256: e62aa2ba11963c558bb7e650fc17f4ad1e36289926ff8c26d05b99e993b109a5

Contents?: true

Size: 640 Bytes

Versions: 1

Compression:

Stored size: 640 Bytes

Contents

#! /usr/local/bin/ruby

require 'xml/parser'

def default; end

p = XML::Parser.new(nil, ":")
#def p.startNamespaceDecl() end
#def p.endNamespaceDecl() end
p.parse($<.read) do |type, name, data|
  case (type)
  when XML::Parser::START_ELEM
    attr = ''
    data.each do |key, value|
      attr += " #{key}=\"#{value}\""
    end
    print "<#{name}#{attr}>"
  when XML::Parser::END_ELEM
    print "</#{name}>"
  when XML::Parser::CDATA
    print data
#  when XML::Parser::START_NAMESPACE_DECL
#    print "start NS: #{name}, #{data}\n"
#  when XML::Parser::END_NAMESPACE_DECL
#    print "start NS: #{name}\n"
  else
    print data
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mame-xmlparser-0.6.81.1 samples/namespaces/namespace1.rb