rho-tau-extensions 6.2.0 → 7.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/libs/crosswalk/ext/platform/android/Rakefile +19 -1
  3. data/libs/enterprise-barcode/ext/platform/android/adds/lib/aarch64/liballbarcode.a +0 -0
  4. data/libs/enterprise-barcode/ext/platform/android/adds/lib/armeabi/liballbarcode.a +0 -0
  5. data/libs/enterprise-barcode/ext/platform/android/adds/lib/x86/liballbarcode.a +0 -0
  6. data/libs/enterprise-barcode/ext/platform/android/allbarcode.jar +0 -0
  7. data/libs/fcm-push-18/ext.yml +20 -0
  8. data/libs/fcm-push-18/ext/android/AndroidManifest.rb +10 -0
  9. data/libs/fcm-push-18/ext/android/ApplicationManifestAdds.erb +39 -0
  10. data/libs/fcm-push-18/ext/android/Rakefile +187 -0
  11. data/libs/fcm-push-18/ext/android/ext_java.files +3 -0
  12. data/libs/fcm-push-18/ext/android/ext_native.files +1 -0
  13. data/libs/fcm-push-18/ext/android/jni/src/fcmpushclient.cpp +215 -0
  14. data/libs/fcm-push-18/ext/android/jni/src/fcmpushclient.h +74 -0
  15. data/libs/fcm-push-18/ext/android/res/res/values/fireBaseValues.xml +5 -0
  16. data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMFacade.java +164 -0
  17. data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMIntentService.java +219 -0
  18. data/libs/fcm-push-18/ext/android/src/com/rhomobile/rhodes/fcm/FCMListener.java +88 -0
  19. data/libs/fcm-push-18/ext/build +16 -0
  20. data/libs/fcm-push-18/ext/build.bat +8 -0
  21. data/libs/fcm-push-18/ext/fcm.xml +9 -0
  22. data/libs/fcm-push-18/ext/iphone/ApplePush_Prefix.pch +7 -0
  23. data/libs/fcm-push-18/ext/iphone/Firebase.h +68 -0
  24. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/FirebaseAnalytics +0 -0
  25. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h +62 -0
  26. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h +115 -0
  27. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsConfiguration.h +1 -0
  28. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalyticsSwiftNameSupport.h +13 -0
  29. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRApp.h +1 -0
  30. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRConfiguration.h +1 -0
  31. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h +389 -0
  32. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIROptions.h +1 -0
  33. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h +485 -0
  34. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h +15 -0
  35. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h +10 -0
  36. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap +10 -0
  37. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/FirebaseCore +0 -0
  38. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h +52 -0
  39. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRApp.h +130 -0
  40. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRConfiguration.h +78 -0
  41. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIRLoggerLevel.h +35 -0
  42. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FIROptions.h +133 -0
  43. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Headers/FirebaseCore.h +5 -0
  44. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCore.framework/Modules/module.modulemap +7 -0
  45. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics +0 -0
  46. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap +6 -0
  47. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/FirebaseInstanceID +0 -0
  48. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h +276 -0
  49. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h +1 -0
  50. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap +7 -0
  51. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/FirebaseMessaging +0 -0
  52. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Headers/FIRMessaging.h +508 -0
  53. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Headers/FirebaseMessaging.h +1 -0
  54. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseMessaging.framework/Modules/module.modulemap +8 -0
  55. data/libs/fcm-push-18/ext/iphone/Frameworks/FirebaseNanoPB.framework/FirebaseNanoPB +0 -0
  56. data/libs/fcm-push-18/ext/iphone/Frameworks/GoogleToolboxForMac.framework/GoogleToolboxForMac +0 -0
  57. data/libs/fcm-push-18/ext/iphone/Frameworks/GoogleToolboxForMac.framework/Modules/module.modulemap +5 -0
  58. data/libs/fcm-push-18/ext/iphone/Frameworks/Protobuf.framework/Modules/module.modulemap +5 -0
  59. data/libs/fcm-push-18/ext/iphone/Frameworks/Protobuf.framework/Protobuf +0 -0
  60. data/libs/fcm-push-18/ext/iphone/Frameworks/nanopb.framework/Modules/module.modulemap +5 -0
  61. data/libs/fcm-push-18/ext/iphone/Frameworks/nanopb.framework/nanopb +0 -0
  62. data/libs/fcm-push-18/ext/iphone/Rakefile +81 -0
  63. data/libs/fcm-push-18/ext/iphone/fcm-push.xcodeproj/project.pbxproj +370 -0
  64. data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.h +28 -0
  65. data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.m +27 -0
  66. data/libs/fcm-push-18/ext/iphone/impl/PushNotificationsReceiver.mm +234 -0
  67. data/libs/fcm-push-18/ext/iphone/impl/applePushSetup.c +10 -0
  68. data/libs/fcm-push-18/ext/iphone/impl/applepushclient.h +69 -0
  69. data/libs/fcm-push-18/ext/iphone/impl/applepushclient.mm +164 -0
  70. data/libs/fcm-push-18/ext/iphone/impl/readme.txt +7 -0
  71. data/libs/fcm-push-18/ext/platform/iphone/impl/readme.txt +7 -0
  72. data/libs/nodejs/ext/platform/android/jxCore/jx.h +17 -1
  73. data/libs/nodejs/ext/platform/android/jxCore/libcares_arm.a +0 -0
  74. data/libs/nodejs/ext/platform/android/jxCore/libcares_ia32.a +0 -0
  75. data/libs/nodejs/ext/platform/android/jxCore/libcares_x64.a +0 -0
  76. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_arm.a +0 -0
  77. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_ia32.a +0 -0
  78. data/libs/nodejs/ext/platform/android/jxCore/libchrome_zlib_x64.a +0 -0
  79. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_arm.a +0 -0
  80. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_ia32.a +0 -0
  81. data/libs/nodejs/ext/platform/android/jxCore/libhttp_parser_x64.a +0 -0
  82. data/libs/nodejs/ext/platform/android/jxCore/libjx_arm.a +0 -0
  83. data/libs/nodejs/ext/platform/android/jxCore/libjx_ia32.a +0 -0
  84. data/libs/nodejs/ext/platform/android/jxCore/libjx_x64.a +0 -0
  85. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_arm.a +0 -0
  86. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_ia32.a +0 -0
  87. data/libs/nodejs/ext/platform/android/jxCore/libopenssl_x64.a +0 -0
  88. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_arm.a +0 -0
  89. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_ia32.a +0 -0
  90. data/libs/nodejs/ext/platform/android/jxCore/libsqlite3_x64.a +0 -0
  91. data/libs/nodejs/ext/platform/android/jxCore/libuv_arm.a +0 -0
  92. data/libs/nodejs/ext/platform/android/jxCore/libuv_ia32.a +0 -0
  93. data/libs/nodejs/ext/platform/android/jxCore/libuv_x64.a +0 -0
  94. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_arm.a +0 -0
  95. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_ia32.a +0 -0
  96. data/libs/nodejs/ext/platform/android/jxCore/libv8_base_x64.a +0 -0
  97. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_arm.a +0 -0
  98. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_ia32.a +0 -0
  99. data/libs/nodejs/ext/platform/android/jxCore/libv8_nosnapshot_x64.a +0 -0
  100. data/libs/nodejs/ext/platform/iphone/jxCore/jx.h +17 -1
  101. data/libs/nodejs/ext/platform/iphone/jxCore/libcares.a +0 -0
  102. data/libs/nodejs/ext/platform/iphone/jxCore/libchrome_zlib.a +0 -0
  103. data/libs/nodejs/ext/platform/iphone/jxCore/libhttp_parser.a +0 -0
  104. data/libs/nodejs/ext/platform/iphone/jxCore/libjx.a +0 -0
  105. data/libs/nodejs/ext/platform/iphone/jxCore/libmozjs.a +0 -0
  106. data/libs/nodejs/ext/platform/iphone/jxCore/libopenssl.a +0 -0
  107. data/libs/nodejs/ext/platform/iphone/jxCore/libsqlite3.a +0 -0
  108. data/libs/nodejs/ext/platform/iphone/jxCore/libuv.a +0 -0
  109. data/libs/rexml-edge/rexml/attlistdecl.rb +63 -0
  110. data/libs/rexml-edge/rexml/attribute.rb +192 -0
  111. data/libs/rexml-edge/rexml/cdata.rb +68 -0
  112. data/libs/rexml-edge/rexml/child.rb +97 -0
  113. data/libs/rexml-edge/rexml/comment.rb +80 -0
  114. data/libs/rexml-edge/rexml/doctype.rb +270 -0
  115. data/libs/rexml-edge/rexml/document.rb +291 -0
  116. data/libs/rexml-edge/rexml/dtd/attlistdecl.rb +11 -0
  117. data/libs/rexml-edge/rexml/dtd/dtd.rb +47 -0
  118. data/libs/rexml-edge/rexml/dtd/elementdecl.rb +18 -0
  119. data/libs/rexml-edge/rexml/dtd/entitydecl.rb +57 -0
  120. data/libs/rexml-edge/rexml/dtd/notationdecl.rb +40 -0
  121. data/libs/rexml-edge/rexml/element.rb +1241 -0
  122. data/libs/rexml-edge/rexml/encoding.rb +51 -0
  123. data/libs/rexml-edge/rexml/entity.rb +174 -0
  124. data/libs/rexml-edge/rexml/formatters/default.rb +112 -0
  125. data/libs/rexml-edge/rexml/formatters/pretty.rb +142 -0
  126. data/libs/rexml-edge/rexml/formatters/transitive.rb +58 -0
  127. data/libs/rexml-edge/rexml/functions.rb +418 -0
  128. data/libs/rexml-edge/rexml/instruction.rb +71 -0
  129. data/libs/rexml-edge/rexml/light/node.rb +196 -0
  130. data/libs/rexml-edge/rexml/namespace.rb +48 -0
  131. data/libs/rexml-edge/rexml/node.rb +76 -0
  132. data/libs/rexml-edge/rexml/output.rb +30 -0
  133. data/libs/rexml-edge/rexml/parent.rb +166 -0
  134. data/libs/rexml-edge/rexml/parseexception.rb +52 -0
  135. data/libs/rexml-edge/rexml/parsers/baseparser.rb +533 -0
  136. data/libs/rexml-edge/rexml/parsers/lightparser.rb +59 -0
  137. data/libs/rexml-edge/rexml/parsers/pullparser.rb +197 -0
  138. data/libs/rexml-edge/rexml/parsers/sax2parser.rb +273 -0
  139. data/libs/rexml-edge/rexml/parsers/streamparser.rb +61 -0
  140. data/libs/rexml-edge/rexml/parsers/treeparser.rb +101 -0
  141. data/libs/rexml-edge/rexml/parsers/ultralightparser.rb +57 -0
  142. data/libs/rexml-edge/rexml/parsers/xpathparser.rb +657 -0
  143. data/libs/rexml-edge/rexml/quickpath.rb +266 -0
  144. data/libs/rexml-edge/rexml/rexml.rb +32 -0
  145. data/libs/rexml-edge/rexml/sax2listener.rb +98 -0
  146. data/libs/rexml-edge/rexml/security.rb +28 -0
  147. data/libs/rexml-edge/rexml/source.rb +297 -0
  148. data/libs/rexml-edge/rexml/streamlistener.rb +93 -0
  149. data/libs/rexml-edge/rexml/syncenumerator.rb +33 -0
  150. data/libs/rexml-edge/rexml/text.rb +426 -0
  151. data/libs/rexml-edge/rexml/undefinednamespaceexception.rb +9 -0
  152. data/libs/rexml-edge/rexml/validation/relaxng.rb +539 -0
  153. data/libs/rexml-edge/rexml/validation/validation.rb +144 -0
  154. data/libs/rexml-edge/rexml/validation/validationexception.rb +10 -0
  155. data/libs/rexml-edge/rexml/xmldecl.rb +116 -0
  156. data/libs/rexml-edge/rexml/xmltokens.rb +85 -0
  157. data/libs/rexml-edge/rexml/xpath.rb +81 -0
  158. data/libs/rexml-edge/rexml/xpath_parser.rb +704 -0
  159. data/version +1 -1
  160. metadata +118 -2
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: false
2
+ require "rexml/child"
3
+ require "rexml/source"
4
+
5
+ module REXML
6
+ # Represents an XML Instruction; IE, <? ... ?>
7
+ # TODO: Add parent arg (3rd arg) to constructor
8
+ class Instruction < Child
9
+ START = '<\?'
10
+ STOP = '\?>'
11
+
12
+ # target is the "name" of the Instruction; IE, the "tag" in <?tag ...?>
13
+ # content is everything else.
14
+ attr_accessor :target, :content
15
+
16
+ # Constructs a new Instruction
17
+ # @param target can be one of a number of things. If String, then
18
+ # the target of this instruction is set to this. If an Instruction,
19
+ # then the Instruction is shallowly cloned (target and content are
20
+ # copied). If a Source, then the source is scanned and parsed for
21
+ # an Instruction declaration.
22
+ # @param content Must be either a String, or a Parent. Can only
23
+ # be a Parent if the target argument is a Source. Otherwise, this
24
+ # String is set as the content of this instruction.
25
+ def initialize(target, content=nil)
26
+ if target.kind_of? String
27
+ super()
28
+ @target = target
29
+ @content = content
30
+ elsif target.kind_of? Instruction
31
+ super(content)
32
+ @target = target.target
33
+ @content = target.content
34
+ end
35
+ @content.strip! if @content
36
+ end
37
+
38
+ def clone
39
+ Instruction.new self
40
+ end
41
+
42
+ # == DEPRECATED
43
+ # See the rexml/formatters package
44
+ #
45
+ def write writer, indent=-1, transitive=false, ie_hack=false
46
+ Kernel.warn( "#{self.class.name}.write is deprecated" )
47
+ indent(writer, indent)
48
+ writer << START.sub(/\\/u, '')
49
+ writer << @target
50
+ writer << ' '
51
+ writer << @content
52
+ writer << STOP.sub(/\\/u, '')
53
+ end
54
+
55
+ # @return true if other is an Instruction, and the content and target
56
+ # of the other matches the target and content of this object.
57
+ def ==( other )
58
+ other.kind_of? Instruction and
59
+ other.target == @target and
60
+ other.content == @content
61
+ end
62
+
63
+ def node_type
64
+ :processing_instruction
65
+ end
66
+
67
+ def inspect
68
+ "<?p-i #{target} ...?>"
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: false
2
+ require 'rexml/xmltokens'
3
+
4
+ # [ :element, parent, name, attributes, children* ]
5
+ # a = Node.new
6
+ # a << "B" # => <a>B</a>
7
+ # a.b # => <a>B<b/></a>
8
+ # a.b[1] # => <a>B<b/><b/><a>
9
+ # a.b[1]["x"] = "y" # => <a>B<b/><b x="y"/></a>
10
+ # a.b[0].c # => <a>B<b><c/></b><b x="y"/></a>
11
+ # a.b.c << "D" # => <a>B<b><c>D</c></b><b x="y"/></a>
12
+ module REXML
13
+ module Light
14
+ # Represents a tagged XML element. Elements are characterized by
15
+ # having children, attributes, and names, and can themselves be
16
+ # children.
17
+ class Node
18
+ NAMESPLIT = /^(?:(#{XMLTokens::NCNAME_STR}):)?(#{XMLTokens::NCNAME_STR})/u
19
+ PARENTS = [ :element, :document, :doctype ]
20
+ # Create a new element.
21
+ def initialize node=nil
22
+ @node = node
23
+ if node.kind_of? String
24
+ node = [ :text, node ]
25
+ elsif node.nil?
26
+ node = [ :document, nil, nil ]
27
+ elsif node[0] == :start_element
28
+ node[0] = :element
29
+ elsif node[0] == :start_doctype
30
+ node[0] = :doctype
31
+ elsif node[0] == :start_document
32
+ node[0] = :document
33
+ end
34
+ end
35
+
36
+ def size
37
+ if PARENTS.include? @node[0]
38
+ @node[-1].size
39
+ else
40
+ 0
41
+ end
42
+ end
43
+
44
+ def each
45
+ size.times { |x| yield( at(x+4) ) }
46
+ end
47
+
48
+ def name
49
+ at(2)
50
+ end
51
+
52
+ def name=( name_str, ns=nil )
53
+ pfx = ''
54
+ pfx = "#{prefix(ns)}:" if ns
55
+ _old_put(2, "#{pfx}#{name_str}")
56
+ end
57
+
58
+ def parent=( node )
59
+ _old_put(1,node)
60
+ end
61
+
62
+ def local_name
63
+ namesplit
64
+ @name
65
+ end
66
+
67
+ def local_name=( name_str )
68
+ _old_put( 1, "#@prefix:#{name_str}" )
69
+ end
70
+
71
+ def prefix( namespace=nil )
72
+ prefix_of( self, namespace )
73
+ end
74
+
75
+ def namespace( prefix=prefix() )
76
+ namespace_of( self, prefix )
77
+ end
78
+
79
+ def namespace=( namespace )
80
+ @prefix = prefix( namespace )
81
+ pfx = ''
82
+ pfx = "#@prefix:" if @prefix.size > 0
83
+ _old_put(1, "#{pfx}#@name")
84
+ end
85
+
86
+ def []( reference, ns=nil )
87
+ if reference.kind_of? String
88
+ pfx = ''
89
+ pfx = "#{prefix(ns)}:" if ns
90
+ at(3)["#{pfx}#{reference}"]
91
+ elsif reference.kind_of? Range
92
+ _old_get( Range.new(4+reference.begin, reference.end, reference.exclude_end?) )
93
+ else
94
+ _old_get( 4+reference )
95
+ end
96
+ end
97
+
98
+ def =~( path )
99
+ XPath.match( self, path )
100
+ end
101
+
102
+ # Doesn't handle namespaces yet
103
+ def []=( reference, ns, value=nil )
104
+ if reference.kind_of? String
105
+ value = ns unless value
106
+ at( 3 )[reference] = value
107
+ elsif reference.kind_of? Range
108
+ _old_put( Range.new(3+reference.begin, reference.end, reference.exclude_end?), ns )
109
+ else
110
+ if value
111
+ _old_put( 4+reference, ns, value )
112
+ else
113
+ _old_put( 4+reference, ns )
114
+ end
115
+ end
116
+ end
117
+
118
+ # Append a child to this element, optionally under a provided namespace.
119
+ # The namespace argument is ignored if the element argument is an Element
120
+ # object. Otherwise, the element argument is a string, the namespace (if
121
+ # provided) is the namespace the element is created in.
122
+ def << element
123
+ if node_type() == :text
124
+ at(-1) << element
125
+ else
126
+ newnode = Node.new( element )
127
+ newnode.parent = self
128
+ self.push( newnode )
129
+ end
130
+ at(-1)
131
+ end
132
+
133
+ def node_type
134
+ _old_get(0)
135
+ end
136
+
137
+ def text=( foo )
138
+ replace = at(4).kind_of?(String)? 1 : 0
139
+ self._old_put(4,replace, normalizefoo)
140
+ end
141
+
142
+ def root
143
+ context = self
144
+ context = context.at(1) while context.at(1)
145
+ end
146
+
147
+ def has_name?( name, namespace = '' )
148
+ at(3) == name and namespace() == namespace
149
+ end
150
+
151
+ def children
152
+ self
153
+ end
154
+
155
+ def parent
156
+ at(1)
157
+ end
158
+
159
+ def to_s
160
+
161
+ end
162
+
163
+ private
164
+
165
+ def namesplit
166
+ return if @name.defined?
167
+ at(2) =~ NAMESPLIT
168
+ @prefix = '' || $1
169
+ @name = $2
170
+ end
171
+
172
+ def namespace_of( node, prefix=nil )
173
+ if not prefix
174
+ name = at(2)
175
+ name =~ NAMESPLIT
176
+ prefix = $1
177
+ end
178
+ to_find = 'xmlns'
179
+ to_find = "xmlns:#{prefix}" if not prefix.nil?
180
+ ns = at(3)[ to_find ]
181
+ ns ? ns : namespace_of( @node[0], prefix )
182
+ end
183
+
184
+ def prefix_of( node, namespace=nil )
185
+ if not namespace
186
+ name = node.name
187
+ name =~ NAMESPLIT
188
+ $1
189
+ else
190
+ ns = at(3).find { |k,v| v == namespace }
191
+ ns ? ns : prefix_of( node.parent, namespace )
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: false
2
+ require 'rexml/xmltokens'
3
+
4
+ module REXML
5
+ # Adds named attributes to an object.
6
+ module Namespace
7
+ # The name of the object, valid if set
8
+ attr_reader :name, :expanded_name
9
+ # The expanded name of the object, valid if name is set
10
+ attr_accessor :prefix
11
+ include XMLTokens
12
+ NAMESPLIT = /^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
13
+
14
+ # Sets the name and the expanded name
15
+ def name=( name )
16
+ @expanded_name = name
17
+ name =~ NAMESPLIT
18
+ if $1
19
+ @prefix = $1
20
+ else
21
+ @prefix = ""
22
+ @namespace = ""
23
+ end
24
+ @name = $2
25
+ end
26
+
27
+ # Compares names optionally WITH namespaces
28
+ def has_name?( other, ns=nil )
29
+ if ns
30
+ return (namespace() == ns and name() == other)
31
+ elsif other.include? ":"
32
+ return fully_expanded_name == other
33
+ else
34
+ return name == other
35
+ end
36
+ end
37
+
38
+ alias :local_name :name
39
+
40
+ # Fully expand the name, even if the prefix wasn't specified in the
41
+ # source file.
42
+ def fully_expanded_name
43
+ ns = prefix
44
+ return "#{ns}:#@name" if ns.size > 0
45
+ return @name
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: false
2
+ require "rexml/parseexception"
3
+ require "rexml/formatters/pretty"
4
+ require "rexml/formatters/default"
5
+
6
+ module REXML
7
+ # Represents a node in the tree. Nodes are never encountered except as
8
+ # superclasses of other objects. Nodes have siblings.
9
+ module Node
10
+ # @return the next sibling (nil if unset)
11
+ def next_sibling_node
12
+ return nil if @parent.nil?
13
+ @parent[ @parent.index(self) + 1 ]
14
+ end
15
+
16
+ # @return the previous sibling (nil if unset)
17
+ def previous_sibling_node
18
+ return nil if @parent.nil?
19
+ ind = @parent.index(self)
20
+ return nil if ind == 0
21
+ @parent[ ind - 1 ]
22
+ end
23
+
24
+ # indent::
25
+ # *DEPRECATED* This parameter is now ignored. See the formatters in the
26
+ # REXML::Formatters package for changing the output style.
27
+ def to_s indent=nil
28
+ unless indent.nil?
29
+ Kernel.warn( "#{self.class.name}.to_s(indent) parameter is deprecated" )
30
+ f = REXML::Formatters::Pretty.new( indent )
31
+ f.write( self, rv = "" )
32
+ else
33
+ f = REXML::Formatters::Default.new
34
+ f.write( self, rv = "" )
35
+ end
36
+ return rv
37
+ end
38
+
39
+ def indent to, ind
40
+ if @parent and @parent.context and not @parent.context[:indentstyle].nil? then
41
+ indentstyle = @parent.context[:indentstyle]
42
+ else
43
+ indentstyle = ' '
44
+ end
45
+ to << indentstyle*ind unless ind<1
46
+ end
47
+
48
+ def parent?
49
+ false;
50
+ end
51
+
52
+
53
+ # Visit all subnodes of +self+ recursively
54
+ def each_recursive(&block) # :yields: node
55
+ self.elements.each {|node|
56
+ block.call(node)
57
+ node.each_recursive(&block)
58
+ }
59
+ end
60
+
61
+ # Find (and return) first subnode (recursively) for which the block
62
+ # evaluates to true. Returns +nil+ if none was found.
63
+ def find_first_recursive(&block) # :yields: node
64
+ each_recursive {|node|
65
+ return node if block.call(node)
66
+ }
67
+ return nil
68
+ end
69
+
70
+ # Returns the position that +self+ holds in its parent's array, indexed
71
+ # from 1.
72
+ def index_in_parent
73
+ parent.index(self)+1
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: false
2
+ require 'rexml/encoding'
3
+
4
+ module REXML
5
+ class Output
6
+ include Encoding
7
+
8
+ attr_reader :encoding
9
+
10
+ def initialize real_IO, encd="iso-8859-1"
11
+ @output = real_IO
12
+ self.encoding = encd
13
+
14
+ @to_utf = encoding != 'UTF-8'
15
+
16
+ if encoding == "UTF-16"
17
+ @output << "\ufeff".encode("UTF-16BE")
18
+ self.encoding = "UTF-16BE"
19
+ end
20
+ end
21
+
22
+ def <<( content )
23
+ @output << (@to_utf ? self.encode(content) : content)
24
+ end
25
+
26
+ def to_s
27
+ "Output[#{encoding}]"
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,166 @@
1
+ # frozen_string_literal: false
2
+ require "rexml/child"
3
+
4
+ module REXML
5
+ # A parent has children, and has methods for accessing them. The Parent
6
+ # class is never encountered except as the superclass for some other
7
+ # object.
8
+ class Parent < Child
9
+ include Enumerable
10
+
11
+ # Constructor
12
+ # @param parent if supplied, will be set as the parent of this object
13
+ def initialize parent=nil
14
+ super(parent)
15
+ @children = []
16
+ end
17
+
18
+ def add( object )
19
+ object.parent = self
20
+ @children << object
21
+ object
22
+ end
23
+
24
+ alias :push :add
25
+ alias :<< :push
26
+
27
+ def unshift( object )
28
+ object.parent = self
29
+ @children.unshift object
30
+ end
31
+
32
+ def delete( object )
33
+ found = false
34
+ @children.delete_if {|c| c.equal?(object) and found = true }
35
+ object.parent = nil if found
36
+ found ? object : nil
37
+ end
38
+
39
+ def each(&block)
40
+ @children.each(&block)
41
+ end
42
+
43
+ def delete_if( &block )
44
+ @children.delete_if(&block)
45
+ end
46
+
47
+ def delete_at( index )
48
+ @children.delete_at index
49
+ end
50
+
51
+ def each_index( &block )
52
+ @children.each_index(&block)
53
+ end
54
+
55
+ # Fetches a child at a given index
56
+ # @param index the Integer index of the child to fetch
57
+ def []( index )
58
+ @children[index]
59
+ end
60
+
61
+ alias :each_child :each
62
+
63
+
64
+
65
+ # Set an index entry. See Array.[]=
66
+ # @param index the index of the element to set
67
+ # @param opt either the object to set, or an Integer length
68
+ # @param child if opt is an Integer, this is the child to set
69
+ # @return the parent (self)
70
+ def []=( *args )
71
+ args[-1].parent = self
72
+ @children[*args[0..-2]] = args[-1]
73
+ end
74
+
75
+ # Inserts an child before another child
76
+ # @param child1 this is either an xpath or an Element. If an Element,
77
+ # child2 will be inserted before child1 in the child list of the parent.
78
+ # If an xpath, child2 will be inserted before the first child to match
79
+ # the xpath.
80
+ # @param child2 the child to insert
81
+ # @return the parent (self)
82
+ def insert_before( child1, child2 )
83
+ if child1.kind_of? String
84
+ child1 = XPath.first( self, child1 )
85
+ child1.parent.insert_before child1, child2
86
+ else
87
+ ind = index(child1)
88
+ child2.parent.delete(child2) if child2.parent
89
+ @children[ind,0] = child2
90
+ child2.parent = self
91
+ end
92
+ self
93
+ end
94
+
95
+ # Inserts an child after another child
96
+ # @param child1 this is either an xpath or an Element. If an Element,
97
+ # child2 will be inserted after child1 in the child list of the parent.
98
+ # If an xpath, child2 will be inserted after the first child to match
99
+ # the xpath.
100
+ # @param child2 the child to insert
101
+ # @return the parent (self)
102
+ def insert_after( child1, child2 )
103
+ if child1.kind_of? String
104
+ child1 = XPath.first( self, child1 )
105
+ child1.parent.insert_after child1, child2
106
+ else
107
+ ind = index(child1)+1
108
+ child2.parent.delete(child2) if child2.parent
109
+ @children[ind,0] = child2
110
+ child2.parent = self
111
+ end
112
+ self
113
+ end
114
+
115
+ def to_a
116
+ @children.dup
117
+ end
118
+
119
+ # Fetches the index of a given child
120
+ # @param child the child to get the index of
121
+ # @return the index of the child, or nil if the object is not a child
122
+ # of this parent.
123
+ def index( child )
124
+ count = -1
125
+ @children.find { |i| count += 1 ; i.hash == child.hash }
126
+ count
127
+ end
128
+
129
+ # @return the number of children of this parent
130
+ def size
131
+ @children.size
132
+ end
133
+
134
+ alias :length :size
135
+
136
+ # Replaces one child with another, making sure the nodelist is correct
137
+ # @param to_replace the child to replace (must be a Child)
138
+ # @param replacement the child to insert into the nodelist (must be a
139
+ # Child)
140
+ def replace_child( to_replace, replacement )
141
+ @children.map! {|c| c.equal?( to_replace ) ? replacement : c }
142
+ to_replace.parent = nil
143
+ replacement.parent = self
144
+ end
145
+
146
+ # Deeply clones this object. This creates a complete duplicate of this
147
+ # Parent, including all descendants.
148
+ def deep_clone
149
+ cl = clone()
150
+ each do |child|
151
+ if child.kind_of? Parent
152
+ cl << child.deep_clone
153
+ else
154
+ cl << child.clone
155
+ end
156
+ end
157
+ cl
158
+ end
159
+
160
+ alias :children :to_a
161
+
162
+ def parent?
163
+ true
164
+ end
165
+ end
166
+ end