File: doctype.rb

package info (click to toggle)
libxml-parser-ruby 0.6.1-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 676 kB
  • ctags: 800
  • sloc: ruby: 5,723; ansic: 1,734; xml: 574; makefile: 152
file content (40 lines) | stat: -rw-r--r-- 829 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /usr/local/bin/ruby

require 'xmlparser'

p = XML::Parser.new(nil, " ")
p.setReturnNSTriplet(true);

def p.startDoctypeDecl(name, sysid, pubid, has_internal)
  p ["startDoctypeDecl", sysid, pubid, has_internal]
end

def p.endDoctypeDecl
  p ["endDoctypeDecl"]
end

def p.elementDecl(name, model)
  p ["elementDecl", name, model]
end

def p.attlistDecl(elname, attname, att_type, dflt, isreq)
  p ["attlistDecl", elname, attname, att_type, dflt, isreq]
end

def p.xmlDecl(version, enc, standalone)
  p ["xmlDecl", version, enc, standalone]
end

def p.entityDecl(name, param, value, base, sysid, pubid, notation)
  p ["entityDecl", name, param, value, base, sysid, pubid, notation]
end

def p.startElement(name, attrs)
  p ["startElement", name, attrs]
end

def p.endElement(name)
  p ["endElement", name]
end

p.parse($<.read)