File: entity.rb

package info (click to toggle)
ruby-xmlparser 0.7.3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 980 kB
  • sloc: ruby: 9,342; ansic: 2,017; makefile: 11
file content (110 lines) | stat: -rw-r--r-- 1,799 bytes parent folder | download | duplicates (9)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
## -*- Ruby -*-
## XML::DOM
## 1998-2001 by yoshidam
##

require 'xml/dom2/node'
require 'xml/dom2/domexception'

module XML
  module DOM

=begin
== Class XML::DOM::Entity

=== superclass
Node
=end
    class Entity<Node

=begin
=== Class Methods

    --- Entity.new(name, pubid, sysid, notation)

creates a new Entity.
=end
      def initialize(name, pubid, sysid, notation)
        super()
        @name = name.freeze
        @pubid = pubid.freeze
        @sysid = sysid.freeze
        @notation = notation.freeze
      end

=begin
=== Methods

    --- Entity#nodeType

[DOM]
returns the nodeType.
=end
      ## [DOM]
      def nodeType
        ENTITY_NODE
      end

=begin
    --- Entity#nodeName

[DOM]
returns the nodeName.
=end
      ## [DOM]
      def nodeName
        @name
      end

=begin
    --- Entity#publicId

returns the publicId of the Entity.
=end
      def publicId
        @pubid
      end

=begin
    --- Entity#systemId

returns the systemId of the Entity.
=end
      def systemId
        @sysid
      end

=begin
    --- Entity#notationName

returns the notationname of the Entity.
=end
      def notationName
        @notation
      end

=begin
    --- Entity#cloneNode(deep = true)

[DOM]
returns the copy of the Entity.
=end
      ## [DOM]
      def cloneNode(deep = true)
        super(deep, @name, @pubid, @sysid, @notation)
      end

      def _checkNode(node)
        unless node.nodeType == ELEMENT_NODE ||
            node.nodeType == PROCESSING_INSTRUCTION_NODE ||
            node.nodeType == COMMENT_NODE ||
            node.nodeType == TEXT_NODE ||
            node.nodeType == CDATA_SECTION_NODE ||
            node.nodeType == ENTITY_REFERENCE_NODE
          raise DOMException.new(DOMException::HIERARCHY_REQUEST_ERR)
        end
      end

    end
  end
end