wirispluginengine 3.62.0.1322 → 7.14.0.1422

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +34 -34
  3. data/app/assets/javascripts/wirispluginengine/WIRISplugins.js +1040 -64
  4. data/app/controllers/wirispluginengine/application_controller.rb +84 -75
  5. data/app/helpers/wirispluginengine/application_helper.rb +4 -4
  6. data/config/routes.rb +4 -4
  7. data/lib/com/wiris/common/WInteger.rb +52 -51
  8. data/lib/com/wiris/plugin/api/Cas.rb +5 -5
  9. data/lib/com/wiris/plugin/api/CleanCache.rb +5 -5
  10. data/lib/com/wiris/plugin/api/Configuration.rb +5 -5
  11. data/lib/com/wiris/plugin/api/ConfigurationKeys.rb +94 -91
  12. data/lib/com/wiris/plugin/api/Editor.rb +5 -5
  13. data/lib/com/wiris/plugin/api/Filter.rb +5 -5
  14. data/lib/com/wiris/plugin/api/ImageFormatController.rb +5 -5
  15. data/lib/com/wiris/plugin/api/ParamsProvider.rb +5 -5
  16. data/lib/com/wiris/plugin/api/PluginBuilder.rb +88 -74
  17. data/lib/com/wiris/plugin/api/Render.rb +5 -5
  18. data/lib/com/wiris/plugin/api/ServiceResourceLoader.rb +5 -5
  19. data/lib/com/wiris/plugin/api/Test.rb +5 -5
  20. data/lib/com/wiris/plugin/api/TextService.rb +5 -5
  21. data/lib/com/wiris/plugin/configuration/ConfigurationUpdater.rb +5 -5
  22. data/lib/com/wiris/plugin/impl/CacheFormulaImpl.rb +15 -0
  23. data/lib/com/wiris/plugin/impl/CacheImpl.rb +124 -0
  24. data/lib/com/wiris/plugin/impl/CasImpl.rb +140 -138
  25. data/lib/com/wiris/plugin/impl/CleanCacheImpl.rb +103 -101
  26. data/lib/com/wiris/plugin/impl/ConfigurationImpl.rb +165 -166
  27. data/lib/com/wiris/plugin/impl/CustomConfigurationUpdater.rb +32 -30
  28. data/lib/com/wiris/plugin/impl/DefaultConfigurationUpdater.rb +24 -22
  29. data/lib/com/wiris/plugin/impl/EditorImpl.rb +80 -78
  30. data/lib/com/wiris/plugin/impl/FileConfigurationUpdater.rb +29 -27
  31. data/lib/com/wiris/plugin/impl/FileStorageAndCache.rb +55 -53
  32. data/lib/com/wiris/plugin/impl/FolderTreeStorageAndCache.rb +65 -134
  33. data/lib/com/wiris/plugin/impl/GenericParamsProviderImpl.rb +50 -48
  34. data/lib/com/wiris/plugin/impl/HttpImpl.rb +49 -48
  35. data/lib/com/wiris/plugin/impl/HttpListener.rb +5 -5
  36. data/lib/com/wiris/plugin/impl/ImageFormatControllerPng.rb +71 -63
  37. data/lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb +37 -28
  38. data/lib/com/wiris/plugin/impl/PluginBuilderImpl.rb +280 -248
  39. data/lib/com/wiris/plugin/impl/RenderImpl.rb +303 -257
  40. data/lib/com/wiris/plugin/impl/ServiceResourceLoaderImpl.rb +41 -39
  41. data/lib/com/wiris/plugin/impl/TestImpl.rb +177 -157
  42. data/lib/com/wiris/plugin/impl/TextFilter.rb +210 -194
  43. data/lib/com/wiris/plugin/impl/TextFilterTags.rb +57 -50
  44. data/lib/com/wiris/plugin/impl/TextServiceImpl.rb +158 -107
  45. data/lib/com/wiris/plugin/storage/StorageAndCache.rb +5 -5
  46. data/lib/com/wiris/util/json/JSon.rb +505 -493
  47. data/lib/com/wiris/util/json/JSonIntegerFormat.rb +17 -16
  48. data/lib/com/wiris/util/json/JsonAPIResponse.rb +70 -0
  49. data/lib/com/wiris/util/json/StringParser.rb +57 -56
  50. data/lib/com/wiris/util/sys/AccessProvider.rb +8 -0
  51. data/lib/com/wiris/util/sys/Cache.rb +8 -0
  52. data/lib/com/wiris/util/sys/HttpConnection.rb +14 -13
  53. data/lib/com/wiris/util/sys/HttpConnectionListener.rb +5 -5
  54. data/lib/com/wiris/util/sys/HttpSync.rb +28 -0
  55. data/lib/com/wiris/util/sys/IniFile.rb +132 -131
  56. data/lib/com/wiris/util/sys/Lock.rb +8 -0
  57. data/lib/com/wiris/util/sys/LockProvider.rb +8 -0
  58. data/lib/com/wiris/util/sys/Store.rb +126 -101
  59. data/lib/com/wiris/util/sys/StoreCache.rb +63 -0
  60. data/lib/com/wiris/util/sys/TimerProxy.rb +21 -0
  61. data/lib/com/wiris/util/sys/TimerTask.rb +8 -0
  62. data/lib/com/wiris/util/type/Arrays.rb +275 -0
  63. data/lib/com/wiris/util/type/ByteBuffer.rb +69 -0
  64. data/lib/com/wiris/util/type/Comparator.rb +8 -0
  65. data/lib/com/wiris/util/type/DataUtils.rb +24 -0
  66. data/lib/com/wiris/util/type/DoubleTools.rb +14 -0
  67. data/lib/com/wiris/util/type/HashCache.rb +43 -0
  68. data/lib/com/wiris/util/type/IntegerTools.rb +32 -0
  69. data/lib/com/wiris/util/type/Queue.rb +31 -0
  70. data/lib/com/wiris/util/type/SortArrayByStringLength.rb +26 -0
  71. data/lib/com/wiris/util/type/SortStringByLength.rb +26 -0
  72. data/lib/com/wiris/util/type/SortedHash.rb +45 -0
  73. data/lib/com/wiris/util/type/Stack.rb +31 -0
  74. data/lib/com/wiris/util/type/StringUtils.rb +56 -0
  75. data/lib/com/wiris/util/type/Tokenizer.rb +40 -0
  76. data/lib/com/wiris/util/type/UrlUtils.rb +78 -0
  77. data/lib/com/wiris/util/xml/ContentHandler.rb +8 -0
  78. data/lib/com/wiris/util/xml/DefaultHandler.rb +25 -0
  79. data/lib/com/wiris/util/xml/EntityResolver.rb +8 -0
  80. data/lib/com/wiris/util/xml/MathMLEntityResolver.rb +19 -0
  81. data/lib/com/wiris/util/xml/SAXParser.rb +470 -0
  82. data/lib/com/wiris/util/xml/SerializableImpl.rb +16 -15
  83. data/lib/com/wiris/util/xml/WCharacterBase.rb +968 -627
  84. data/lib/com/wiris/util/xml/WEntities.rb +11 -9
  85. data/lib/com/wiris/util/xml/WXmlUtils.rb +660 -490
  86. data/lib/com/wiris/util/xml/XmlSerializer.rb +517 -471
  87. data/lib/com/wiris/util/xml/XmlWriter.rb +260 -262
  88. data/lib/loader.rb +15 -12
  89. data/lib/src-generic/Array.rb +22 -22
  90. data/lib/src-generic/ArrayInt.rb +31 -31
  91. data/lib/src-generic/Base64.rb +14 -14
  92. data/lib/src-generic/BaseCode.rb +93 -93
  93. data/lib/src-generic/Boolean.rb +27 -0
  94. data/lib/src-generic/Bytes.rb +50 -50
  95. data/lib/src-generic/BytesInput.rb +37 -37
  96. data/lib/src-generic/EReg.rb +55 -55
  97. data/lib/src-generic/File.rb +35 -35
  98. data/lib/src-generic/FileLock.rb +26 -26
  99. data/lib/src-generic/FileSystem.rb +37 -37
  100. data/lib/src-generic/Hash.rb +42 -42
  101. data/lib/src-generic/Http.rb +111 -107
  102. data/lib/src-generic/HttpRequest.rb +25 -25
  103. data/lib/src-generic/HttpResponse.rb +70 -70
  104. data/lib/src-generic/Iterator.rb +20 -19
  105. data/lib/src-generic/Math.rb +14 -14
  106. data/lib/src-generic/Md5.rb +8 -8
  107. data/lib/src-generic/Md5Tools.rb +11 -11
  108. data/lib/src-generic/PropertiesTools.rb +32 -32
  109. data/lib/src-generic/Reflect.rb +16 -16
  110. data/lib/src-generic/RubyConfigurationUpdater.rb +49 -45
  111. data/lib/src-generic/Serializer.rb +84 -84
  112. data/lib/src-generic/Std.rb +74 -74
  113. data/lib/src-generic/Storage.rb +152 -152
  114. data/lib/src-generic/StringBuf.rb +40 -40
  115. data/lib/src-generic/StringTools.rb +44 -46
  116. data/lib/src-generic/Timer.rb +6 -6
  117. data/lib/src-generic/Type.rb +18 -18
  118. data/lib/src-generic/TypeTools.rb +31 -31
  119. data/lib/src-generic/Unserializer.rb +72 -72
  120. data/lib/src-generic/Utf8.rb +26 -26
  121. data/lib/src-generic/Xml.rb +199 -198
  122. data/lib/src-generic/extended/Integer.rb +5 -5
  123. data/lib/src-generic/extended/Math.rb +6 -6
  124. data/lib/src-generic/extended/Properties.rb +11 -11
  125. data/lib/src-generic/extended/String.rb +38 -38
  126. data/lib/src-generic/settings/PlatformSettings.rb +18 -18
  127. data/lib/src-generic/system/HttpProxy.rb +23 -0
  128. data/lib/src-generic/system/HttpProxyAuth.rb +10 -0
  129. data/lib/wirispluginengine.rb +5 -5
  130. data/lib/wirispluginengine/engine.rb +5 -5
  131. data/lib/wirispluginengine/integration/cleancache.rb +8 -8
  132. data/lib/wirispluginengine/integration/configurationjs.rb +8 -15
  133. data/lib/wirispluginengine/integration/configurationjson.rb +6 -6
  134. data/lib/wirispluginengine/integration/createimage.rb +7 -7
  135. data/lib/wirispluginengine/integration/getmathml.rb +18 -18
  136. data/lib/wirispluginengine/integration/resource.rb +8 -8
  137. data/lib/wirispluginengine/integration/service.rb +5 -5
  138. data/lib/wirispluginengine/integration/showimage.rb +28 -21
  139. data/lib/wirispluginengine/integration/test.rb +5 -5
  140. data/lib/wirispluginengine/integration/testfilter.rb +10 -0
  141. data/lib/wirispluginengine/version.rb +2 -2
  142. data/resources/VERSION +1 -1
  143. data/resources/WEB-INF/web.xml +25 -0
  144. data/resources/WIRISplugins.js +3809 -0
  145. data/resources/default-configuration.ini +47 -45
  146. data/resources/tech.txt +1 -1
  147. data/resources/wirisplugin.css +43 -42
  148. metadata +40 -4
  149. data/configuration.ini.dist +0 -104
@@ -1,279 +1,277 @@
1
1
  module WirisPlugin
2
2
  include Wiris
3
- require('com/wiris/util/xml/WXmlUtils.rb')
4
- class XmlWriter
5
- include Wiris
3
+ require('com/wiris/util/xml/WXmlUtils.rb')
4
+ require('com/wiris/util/xml/ContentHandler.rb')
5
+ require('com/wiris/util/xml/ContentHandler.rb')
6
+ class XmlWriter
7
+ extend ContentHandlerInterface
6
8
 
7
- INDENT_STRING = " "
8
- ECHO_FILTER = 2
9
- AUTO_IGNORING_SPACE_FILTER = 1
10
- PRETTY_PRINT_FILTER = 0
11
- @prettyPrint = true
12
- attr_accessor :prettyPrint
13
- @xmlDeclaration = false
14
- attr_accessor :xmlDeclaration
15
- @autoIgnoringWhitespace = true
16
- attr_accessor :autoIgnoringWhitespace
17
- attr_accessor :inlineElements
18
- attr_accessor :filter
19
- attr_accessor :tagOpen
20
- attr_accessor :firstLine
21
- attr_accessor :inline
22
- attr_accessor :inlineMark
23
- attr_accessor :depth
24
- attr_accessor :cdataSection
25
- attr_accessor :currentPrefixes
26
- attr_accessor :hasWhiteSpace
27
- attr_accessor :nameSpace
28
- attr_accessor :whiteSpace
29
- attr_accessor :sb
30
- def initialize()
31
- super()
32
- @filter = PRETTY_PRINT_FILTER
33
- @xmlDeclaration = false
34
- @inlineElements = Array.new()
35
- @firstLine = generateFirstLine("UTF-8")
36
- reset()
37
- end
38
- def setFilter(filterType)
39
- @filter = filterType
40
- end
41
- def getFilter()
42
- return @filter
43
- end
44
- def setXmlDeclaration(xmlFragment)
45
- @xmlDeclaration = xmlFragment
46
- end
47
- def isXmlDeclaration()
48
- return @xmlDeclaration
49
- end
50
- def setInlineElements(inlineElements)
51
- if inlineElements!=nil
52
- @inlineElements = inlineElements
53
- else
54
- @inlineElements = Array.new()
55
- end
56
- end
57
- def getInlineElements()
58
- return @inlineElements
59
- end
60
- def startDocument()
61
- reset()
62
- if @xmlDeclaration
63
- write(@firstLine)
64
- end
65
- if !@prettyPrint
66
- write("\n")
67
- end
68
- end
69
- def endDocument()
70
- closeOpenTag(false)
71
- end
72
- def startPrefixMapping(prefix,uri)
73
- if (uri==@currentPrefixes::get(prefix))
74
- return
75
- end
76
- if uri::length()==0
77
- return
78
- end
79
- pref = prefix
80
- if prefix::length()>0
81
- pref = ":"+prefix
82
- end
83
- ns = (((" xmlns"+pref)+"=\"")+uri)+"\""
84
- @nameSpace::add(ns)
85
- @currentPrefixes::set(prefix,uri)
86
- end
87
- def endPrefixMapping(prefix)
88
- @currentPrefixes::remove(prefix)
89
- end
90
- def startElement(uri,localName,qName,atts)
91
- closeOpenTag(false)
92
- processWhiteSpace(@inline||!(@autoIgnoringWhitespace||@prettyPrint))
93
- if @prettyPrint&&!@inline
94
- writeIndent()
95
- end
96
- name = qName
97
- if (name==nil)||(name::length()==0)
98
- name = localName
99
- end
100
- write("<"+name)
101
- writeAttributes(atts)
102
- if @nameSpace!=nil
103
- write(@nameSpace::toString())
104
- @nameSpace = nil
105
- end
106
- @tagOpen = true
107
- if !@inline&&@inlineElements::contains_(name)
108
- @inlineMark = @depth
109
- @inline = true
110
- end
111
- @depth+=1
112
- end
113
- def endElement(uri,localName,qName)
114
- name = qName
115
- if (name==nil)||(name::length()==0)
116
- name = localName
117
- end
118
- writeSpace = (@tagOpen||@inline)||!(@autoIgnoringWhitespace||@prettyPrint)
119
- processWhiteSpace(writeSpace)
120
- @depth-=1
121
- if @tagOpen
122
- closeOpenTag(true)
123
- else
124
- if (!@inline&&@prettyPrint)&&!writeSpace
125
- writeIndent()
9
+ include Wiris
10
+
11
+ INDENT_STRING = " "
12
+ ECHO_FILTER = 2
13
+ AUTO_IGNORING_SPACE_FILTER = 1
14
+ PRETTY_PRINT_FILTER = 0
15
+ @prettyPrint;
16
+ attr_accessor :prettyPrint
17
+ @xmlDeclaration;
18
+ attr_accessor :xmlDeclaration
19
+ @autoIgnoringWhitespace;
20
+ attr_accessor :autoIgnoringWhitespace
21
+ attr_accessor :inlineElements
22
+ attr_accessor :filter
23
+ @ignoreEntities;
24
+ attr_accessor :ignoreEntities
25
+ attr_accessor :tagOpen
26
+ attr_accessor :firstLine
27
+ attr_accessor :isInline
28
+ attr_accessor :inlineMark
29
+ attr_accessor :depth
30
+ attr_accessor :cdataSection
31
+ attr_accessor :currentPrefixes
32
+ attr_accessor :hasWhiteSpace
33
+ attr_accessor :nameSpace
34
+ attr_accessor :whiteSpace
35
+ attr_accessor :sb
36
+ def initialize()
37
+ super()
38
+ @filter = PRETTY_PRINT_FILTER
39
+ @xmlDeclaration = false
40
+ @inlineElements = Array.new()
41
+ @firstLine = generateFirstLine("UTF-8")
42
+ reset()
126
43
  end
127
- write(("</"+name)+">")
128
- end
129
- if @inline&&(@inlineMark==@depth)
130
- @inline = false
131
- @inlineMark = -1
132
- end
133
- end
134
- def startCDATA()
135
- closeOpenTag(false)
136
- write("<![CDATA[")
137
- @cdataSection = true
138
- end
139
- def endCDATA()
140
- @cdataSection = false
141
- write("]]>")
142
- end
143
- def characters(ch,start,length)
144
- if @cdataSection
145
- writeChars(ch,start,length)
146
- else
147
- if !@inline
148
- if self.class.isWhiteSpace(ch,start,length)
149
- @hasWhiteSpace = true
150
- for i in start..start+length-1
151
- @whiteSpace::addChar(ch[i])
152
- i+=1
153
- end
154
- return
155
- else
156
- processWhiteSpace(true)
157
- @inlineMark = @depth-1
158
- @inline = true
159
- end
44
+ def setFilter(filterType)
45
+ self.filter = filterType
160
46
  end
161
- closeOpenTag(false)
162
- writeTextChars(ch,start,length)
163
- end
164
- end
165
- def writeChars(ch,start,length)
166
- for i in start..start+length-1
167
- @sb::addChar(ch[i])
168
- i+=1
47
+ def getFilter()
48
+ return @filter
169
49
  end
170
- end
171
- def write(s)
172
- @sb::add(s)
173
- end
174
- def writeText(s)
175
- @sb::add(WXmlUtils::htmlEscape(s))
176
- end
177
- def writeTextChars(ch,start,length)
178
- s = StringBuf.new()
179
- for i in start..start+length-1
180
- s::addChar(ch[i])
181
- i+=1
50
+ def setXmlDeclaration(xmlFragment)
51
+ self.xmlDeclaration = xmlFragment
182
52
  end
183
- @sb::add(WXmlUtils::htmlEscape(s::toString()))
184
- end
185
- def self.isWhiteSpace(chars,start,length)
186
- for i in start..start+length-1
187
- c = chars[i]
188
- if !((((c==' ')||(c=="\n"))||(c=="\r"))||(c=="\t"))
189
- return false
190
- end
191
- i+=1
53
+ def isXmlDeclaration()
54
+ return @xmlDeclaration
192
55
  end
193
- return true
194
- end
195
- def closeOpenTag(endElement)
196
- if @tagOpen
197
- if endElement
198
- write("/")
56
+ def setInlineElements(inlineElements)
57
+ if inlineElements != nil
58
+ self.inlineElements = inlineElements
59
+ else
60
+ self.inlineElements = Array.new()
61
+ end
199
62
  end
200
- write(">")
201
- @tagOpen = false
202
- end
203
- end
204
- def writeAttributes(atts)
205
- if atts==nil
206
- return
207
- end
208
- for i in 0..atts::getLength()-1
209
- name = atts::getName(i)
210
- value = atts::getValue(i)
211
- if name::startsWith("xmlns")
212
- prefix = nil
213
- uri = value
214
- if name::length()>5
215
- if name::charAt(6)==':'
216
- prefix = name::substring(6)
217
- end
63
+ def getInlineElements()
64
+ return @inlineElements
65
+ end
66
+ def startDocument()
67
+ reset()
68
+ if @xmlDeclaration
69
+ write(@firstLine)
70
+ end
71
+ if !@prettyPrint
72
+ write("\n")
73
+ end
74
+ end
75
+ def endDocument()
76
+ closeOpenTag(false)
77
+ end
78
+ def startPrefixMapping(prefix, uri)
79
+ if (uri == @currentPrefixes::get(prefix))
80
+ return
81
+ end
82
+ if uri::length() == 0
83
+ return
84
+ end
85
+ pref = prefix
86
+ if prefix::length() > 0
87
+ pref = ":" + prefix
88
+ end
89
+ ns = (((" xmlns" + pref) + "=\"") + uri) + "\""
90
+ @nameSpace::add(ns)
91
+ @currentPrefixes::set(prefix,uri)
92
+ end
93
+ def endPrefixMapping(prefix)
94
+ @currentPrefixes::remove(prefix)
95
+ end
96
+ def startElement(uri, localName, qName, atts)
97
+ closeOpenTag(false)
98
+ processWhiteSpace(@isInline || !(@autoIgnoringWhitespace || @prettyPrint))
99
+ if @prettyPrint && !@isInline
100
+ writeIndent()
101
+ end
102
+ name = qName
103
+ if (name == nil) || (name::length() == 0)
104
+ name = localName
105
+ end
106
+ write("<" + name)
107
+ writeAttributes(atts)
108
+ if @nameSpace != nil
109
+ write(@nameSpace::toString())
110
+ @nameSpace = nil
111
+ end
112
+ @tagOpen = true
113
+ if !@isInline && @inlineElements::contains_(name)
114
+ @inlineMark = @depth
115
+ @isInline = true
116
+ end
117
+ @depth+=1
118
+ end
119
+ def endElement(uri, localName, qName)
120
+ name = qName
121
+ if (name == nil) || (name::length() == 0)
122
+ name = localName
123
+ end
124
+ writeSpace = (@tagOpen || @isInline) || !(@autoIgnoringWhitespace || @prettyPrint)
125
+ processWhiteSpace(writeSpace)
126
+ @depth-=1
127
+ if @tagOpen
128
+ closeOpenTag(true)
218
129
  else
219
- prefix = ""
130
+ if (!@isInline && @prettyPrint) && !writeSpace
131
+ writeIndent()
132
+ end
133
+ write(("</" + name) + ">")
220
134
  end
221
- if (prefix!=nil)&&(uri==@currentPrefixes::get(prefix))
222
- next
135
+ if @isInline && (@inlineMark == @depth)
136
+ @isInline = false
137
+ @inlineMark = -1
223
138
  end
224
- end
225
- write(" ")
226
- write(name)
227
- write("=\"")
228
- writeText(value)
229
- write("\"")
230
- i+=1
231
139
  end
232
- end
233
- def processWhiteSpace(write)
234
- if @hasWhiteSpace&&write
235
- closeOpenTag(false)
236
- writeText(@whiteSpace::toString())
237
- end
238
- @whiteSpace = StringBuf.new()
239
- @hasWhiteSpace = false
240
- end
241
- def writeIndent()
242
- write("\n")
243
- for i in 0..@depth-1
244
- write(INDENT_STRING)
245
- i+=1
140
+ def startCDATA()
141
+ closeOpenTag(false)
142
+ write("<![CDATA[")
143
+ @cdataSection = true
246
144
  end
247
- end
248
- def generateFirstLine(encoding)
249
- return ("<?xml version=\"1.0\" encoding=\""+encoding)+"\"?>"
250
- end
251
- def reset()
252
- @tagOpen = false
253
- @inline = false
254
- @inlineMark = -1
255
- @depth = 0
256
- @cdataSection = false
257
- @hasWhiteSpace = false
258
- @currentPrefixes = Hash.new()
259
- @whiteSpace = StringBuf.new()
260
- @nameSpace = StringBuf.new()
261
- @sb = StringBuf.new()
262
- if @filter==PRETTY_PRINT_FILTER
263
- @autoIgnoringWhitespace = true
264
- @prettyPrint = true
265
- else
266
- if @filter==AUTO_IGNORING_SPACE_FILTER
267
- @autoIgnoringWhitespace = true
268
- @prettyPrint = false
269
- else
270
- @autoIgnoringWhitespace = false
271
- @prettyPrint = false
145
+ def endCDATA()
146
+ @cdataSection = false
147
+ write("]]>")
272
148
  end
273
- end
274
- end
275
- def toString()
276
- return sb::toString()
149
+ def characters(ch)
150
+ if @cdataSection
151
+ @sb::add(ch)
152
+ else
153
+ if !@isInline
154
+ if XmlWriter.isWhiteSpace(ch)
155
+ @hasWhiteSpace = true
156
+ @whiteSpace::add(ch)
157
+ return
158
+ else
159
+ processWhiteSpace(true)
160
+ @inlineMark = @depth - 1
161
+ @isInline = true
162
+ end
163
+ end
164
+ closeOpenTag(false)
165
+ if @ignoreEntities
166
+ @sb::add(ch)
167
+ else
168
+ @sb::add(WXmlUtils::htmlEscape(ch))
169
+ end
170
+ end
171
+ end
172
+ def write(s)
173
+ @sb::add(s)
174
+ end
175
+ def writeText(s)
176
+ @sb::add(WXmlUtils::htmlEscape(s))
177
+ end
178
+ def self.isWhiteSpace(text)
179
+ it = Utf8::getIterator(text)
180
+ while it::hasNext()
181
+ c = it::next()
182
+ if (((c != 32) && (c != 10)) && (c != 13)) && (c != 9)
183
+ return false
184
+ end
185
+ end
186
+ return true
187
+ end
188
+ def closeOpenTag(endElement)
189
+ if @tagOpen
190
+ if endElement
191
+ write("/")
192
+ end
193
+ write(">")
194
+ @tagOpen = false
195
+ end
196
+ end
197
+ def writeAttributes(atts)
198
+ if atts == nil
199
+ return
200
+ end
201
+ for i in 0..atts::getLength() - 1
202
+ name = atts::getName(i)
203
+ value = atts::getValue(i)
204
+ if name::startsWith("xmlns")
205
+ prefix = nil
206
+ uri = value
207
+ if name::length() > 5
208
+ if Std::charCodeAt(name,6) == 54
209
+ prefix = Std::substr(name,6)
210
+ end
211
+ else
212
+ prefix = ""
213
+ end
214
+ if (prefix != nil) && (uri == @currentPrefixes::get(prefix))
215
+ next
216
+ end
217
+ end
218
+ write(" ")
219
+ write(name)
220
+ write("=\"")
221
+ writeText(value)
222
+ write("\"")
223
+ i+=1
224
+ end
225
+ end
226
+ def processWhiteSpace(write)
227
+ if @hasWhiteSpace && write
228
+ closeOpenTag(false)
229
+ writeText(@whiteSpace::toString())
230
+ end
231
+ @whiteSpace = StringBuf.new()
232
+ @hasWhiteSpace = false
233
+ end
234
+ def writeIndent()
235
+ write("\n")
236
+ for i in 0..@depth - 1
237
+ write(INDENT_STRING)
238
+ i+=1
239
+ end
240
+ end
241
+ def generateFirstLine(encoding)
242
+ return ("<?xml version=\"1.0\" encoding=\"" + encoding) + "\"?>"
243
+ end
244
+ def reset()
245
+ @tagOpen = false
246
+ @isInline = false
247
+ @inlineMark = -1
248
+ @depth = 0
249
+ @cdataSection = false
250
+ @hasWhiteSpace = false
251
+ @currentPrefixes = Hash.new()
252
+ @whiteSpace = StringBuf.new()
253
+ @nameSpace = StringBuf.new()
254
+ @sb = StringBuf.new()
255
+ if @filter == PRETTY_PRINT_FILTER
256
+ @autoIgnoringWhitespace = true
257
+ @prettyPrint = true
258
+ else
259
+ if @filter == AUTO_IGNORING_SPACE_FILTER
260
+ @autoIgnoringWhitespace = true
261
+ @prettyPrint = false
262
+ else
263
+ @autoIgnoringWhitespace = false
264
+ @prettyPrint = false
265
+ end
266
+ end
267
+ end
268
+ def toString()
269
+ return self.sb::toString()
270
+ end
271
+
272
+ @prettyPrint = true
273
+ @xmlDeclaration = false
274
+ @autoIgnoringWhitespace = true
275
+ @ignoreEntities = false
277
276
  end
278
- end
279
277
  end