File: skippedentity.rb

package info (click to toggle)
libxml-parser-ruby 0.6.8-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 912 kB
  • ctags: 1,523
  • sloc: ruby: 11,080; ansic: 1,958; xml: 467; makefile: 59
file content (48 lines) | stat: -rw-r--r-- 807 bytes parent folder | download | duplicates (3)
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
41
42
43
44
45
46
47
48
#! /usr/local/bin/ruby

require 'xml/parser'

p = XML::Parser.new

def p.skippedEntity(entityName, is_param_ent)
  p(["skippedEntity", entityName, is_param_ent])
end

def p.default(data)
 p(["default", data])
end

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

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

def p.character(data)
  p(["character", data])
end

def p.externalEntityRef(context, base, sys, pub)
  p(["externalEntityRef", context, base, sys, pub])
  extp = XML::Parser.new(self, context)
  extp.parse(<<EOF)
<!ENTITY % tttt "<!ENTITY test 'BOKE'>">
<!ENTITY test "%tttt;">
<!ENTITY test1 "%Tttt;">
%aaaa;
EOF
  extp.done
end
p.setParamEntityParsing(1)

p.parse(<<EOF)
<!DOCTYPE test SYSTEM "ext.dtd" [
<!--ENTITY test "HOGE"-->
%TTTT;
]>
<test>
  &test;
</test>
EOF