241 "Only a ApplicationExtension may be a child of a ApplicationExtensions!");
242 }
243
244 String applicationIDString =
245 getStringAttribute(applicationExtension, "applicationID",
246 null, true, null);
247
248 String authenticationCodeString =
249 getStringAttribute(applicationExtension, "authenticationCode",
250 null, true, null);
251
252 Object applicationExtensionData =
253 applicationExtension.getUserObject();
254 if (applicationExtensionData == null ||
255 !(applicationExtensionData instanceof byte[])) {
256 fatal(applicationExtension,
257 "Bad user object in ApplicationExtension!");
258 }
259
260 if (applicationIDs == null) {
261 applicationIDs = new ArrayList();
262 authenticationCodes = new ArrayList();
263 applicationData = new ArrayList();
264 }
265
266 applicationIDs.add(fromISO8859(applicationIDString));
267 authenticationCodes.add(fromISO8859(authenticationCodeString));
268 applicationData.add(applicationExtensionData);
269 } else if (name.equals("CommentExtensions")) {
270 Node commentExtension = node.getFirstChild();
271 if (commentExtension != null) {
272 while(commentExtension != null) {
273 if (!commentExtension.getNodeName().equals("CommentExtension")) {
274 fatal(node,
275 "Only a CommentExtension may be a child of a CommentExtensions!");
276 }
277
278 if (comments == null) {
279 comments = new ArrayList();
280 }
281
282 String comment =
283 getStringAttribute(commentExtension, "value", null,
284 true, null);
285
286 comments.add(fromISO8859(comment));
287
288 commentExtension = commentExtension.getNextSibling();
289 }
290 }
291 } else {
292 fatal(node, "Unknown child of root node!");
293 }
294
295 node = node.getNextSibling();
296 }
297 }
298
299 protected void mergeStandardTree(Node root)
350 "value",
351 -1, true,
352 true, 0, 65535);
353 }
354 childNode = childNode.getNextSibling();
355 }
356 } else if (name.equals("Text")) {
357 Node childNode = node.getFirstChild();
358 while(childNode != null) {
359 String childName = childNode.getNodeName();
360 if (childName.equals("TextEntry") &&
361 getAttribute(childNode, "compression",
362 "none", false).equals("none") &&
363 Charset.isSupported(getAttribute(childNode,
364 "encoding",
365 "ISO-8859-1",
366 false))) {
367 String value = getAttribute(childNode, "value");
368 byte[] comment = fromISO8859(value);
369 if (comments == null) {
370 comments = new ArrayList();
371 }
372 comments.add(comment);
373 }
374 childNode = childNode.getNextSibling();
375 }
376 } else if (name.equals("Transparency")) {
377 Node childNode = node.getFirstChild();
378 while(childNode != null) {
379 String childName = childNode.getNodeName();
380 if (childName.equals("TransparentIndex")) {
381 transparentColorIndex = getIntAttribute(childNode,
382 "value",
383 -1, true,
384 true, 0, 255);
385 transparentColorFlag = true;
386 break;
387 }
388 childNode = childNode.getNextSibling();
389 }
390 }
|
241 "Only a ApplicationExtension may be a child of a ApplicationExtensions!");
242 }
243
244 String applicationIDString =
245 getStringAttribute(applicationExtension, "applicationID",
246 null, true, null);
247
248 String authenticationCodeString =
249 getStringAttribute(applicationExtension, "authenticationCode",
250 null, true, null);
251
252 Object applicationExtensionData =
253 applicationExtension.getUserObject();
254 if (applicationExtensionData == null ||
255 !(applicationExtensionData instanceof byte[])) {
256 fatal(applicationExtension,
257 "Bad user object in ApplicationExtension!");
258 }
259
260 if (applicationIDs == null) {
261 applicationIDs = new ArrayList<>();
262 authenticationCodes = new ArrayList<>();
263 applicationData = new ArrayList<>();
264 }
265
266 applicationIDs.add(fromISO8859(applicationIDString));
267 authenticationCodes.add(fromISO8859(authenticationCodeString));
268 applicationData.add((byte[]) applicationExtensionData);
269 } else if (name.equals("CommentExtensions")) {
270 Node commentExtension = node.getFirstChild();
271 if (commentExtension != null) {
272 while(commentExtension != null) {
273 if (!commentExtension.getNodeName().equals("CommentExtension")) {
274 fatal(node,
275 "Only a CommentExtension may be a child of a CommentExtensions!");
276 }
277
278 if (comments == null) {
279 comments = new ArrayList<>();
280 }
281
282 String comment =
283 getStringAttribute(commentExtension, "value", null,
284 true, null);
285
286 comments.add(fromISO8859(comment));
287
288 commentExtension = commentExtension.getNextSibling();
289 }
290 }
291 } else {
292 fatal(node, "Unknown child of root node!");
293 }
294
295 node = node.getNextSibling();
296 }
297 }
298
299 protected void mergeStandardTree(Node root)
350 "value",
351 -1, true,
352 true, 0, 65535);
353 }
354 childNode = childNode.getNextSibling();
355 }
356 } else if (name.equals("Text")) {
357 Node childNode = node.getFirstChild();
358 while(childNode != null) {
359 String childName = childNode.getNodeName();
360 if (childName.equals("TextEntry") &&
361 getAttribute(childNode, "compression",
362 "none", false).equals("none") &&
363 Charset.isSupported(getAttribute(childNode,
364 "encoding",
365 "ISO-8859-1",
366 false))) {
367 String value = getAttribute(childNode, "value");
368 byte[] comment = fromISO8859(value);
369 if (comments == null) {
370 comments = new ArrayList<>();
371 }
372 comments.add(comment);
373 }
374 childNode = childNode.getNextSibling();
375 }
376 } else if (name.equals("Transparency")) {
377 Node childNode = node.getFirstChild();
378 while(childNode != null) {
379 String childName = childNode.getNodeName();
380 if (childName.equals("TransparentIndex")) {
381 transparentColorIndex = getIntAttribute(childNode,
382 "value",
383 -1, true,
384 true, 0, 255);
385 transparentColorFlag = true;
386 break;
387 }
388 childNode = childNode.getNextSibling();
389 }
390 }
|