Ticket #1006 (closed bug: fixed)

Opened 6 years ago

Last modified 6 years ago

Text nodes limited to 4096 characters in length.

Reported by: openlayers Owned by: tschaub
Priority: critical Milestone: 2.5 Release
Component: Format.XML Version: 2.5 RC1
Keywords: Cc: pete@…
State:

Description (last modified by tschaub) (diff)

When parsing XML, we have to be aware of a browser limitation. Given XML that has a text node longer than 4096 characters, the text will be split among multiple child nodes of the original parent. For parsing long linestrings (and linearrings) this poses a problem.

Attachments

svg_from_24.txt Download (8.4 KB) - added by openlayers 6 years ago.
SVG generated by 2.4
svg_from_25rc1.txt Download (7.2 KB) - added by openlayers 6 years ago.
SVG generated by 2.5rc1
testcase.xml Download (11.8 KB) - added by openlayers 6 years ago.
GML used as source for SVG layer
nodeValue.patch Download (3.5 KB) - added by tschaub 6 years ago.
concatenate value of all child nodes

Change History

Changed 6 years ago by crschmidt

  • milestone set to 2.5 Release

Please post both the SVG and, if possible, the GML.

Changed 6 years ago by openlayers

SVG generated by 2.4

Changed 6 years ago by openlayers

SVG generated by 2.5rc1

Changed 6 years ago by openlayers

Actually, further investigation reveals that the SVG contains "NaN" as the last coordinate, as generated by 2.5rc1.

Changed 6 years ago by openlayers

GML used as source for SVG layer

Changed 6 years ago by openlayers

  • cc pete@… added

Changed 6 years ago by tschaub

The browser is imposing a 4kb (4096 character limit) on child nodes. We can work around this, but I have a hard time believing it is a regression (that it would have worked in 2.4). If someone can demonstrate that the old GML parser handled this, I'll get on it for 2.5 - but otherwise, this may slip to 2.6.

Changed 6 years ago by openlayers

If that's the case, then it's probably the extra digits of precision that appeared in 2.5 that are taking it over the limit. I'll look at it more during daylight hours.

(pete@…)

Changed 6 years ago by tschaub

The fix doesn't look that bad. I'll post something if I get it together. Are you sure the extra digits didn't appear on your end? It's the length of the GML node that is a problem - before parsing.

Changed 6 years ago by tschaub

concatenate value of all child nodes

Changed 6 years ago by tschaub

  • keywords review added
  • description modified (diff)
  • summary changed from Firefox SVG rendering problems with Layer.GML to Text nodes limited to 4096 characters in length.

The node value patch fixes the problem. Firefox (and I assume others) truncates a text node to 4kb, spreading the text among multiple children. So where we had a single node before, we now have many. Again, this doesn't seem to me to be a regression.

The attach patch gives the XML parser a concatChildValues method. This returns the concatenated value of all child nodes - giving you what you'd expect for text nodes over 4096 characters in length. No tests for me tonight, but I'm marking review so that others can weigh in.

Changed 6 years ago by tschaub

  • owner set to tschaub
  • component changed from Renderer.SVG to Format.XML

Changed 6 years ago by crschmidt

I don't have a problem with it, but we should definitely have a test before we put it in. It seems like the right way to go.

Changed 6 years ago by openlayers

I can confirm that the patch solved the problem here on my end. (pete@…)

Changed 6 years ago by crschmidt

  • keywords commit added; review removed

I put together a test for this, but decided that sticking 4k of data in a test file was not the right way to go about this. I think we should rethink our methods of testing the various format classes: with the manual testing we've done, I'm happy to have it go in, and we just need to be aware that we need tests for it -- NeedsTests lists it so we don't forget.

Pete, thanks for the report and the feedback.

Changed 6 years ago by tschaub

All existing tests pass in IE and FF.

Changed 6 years ago by tschaub

(In [4410]) Adding a concatChildValues method to the XML parser. This gets around a messy 4kb limit for text node lengths - over which browsers split values among multiple siblings (see #1006).

Changed 6 years ago by tschaub

  • keywords pullup added; commit removed

Changed 6 years ago by crschmidt

  • keywords pullup removed
  • status changed from new to closed
  • resolution set to fixed

(In [4432]) Pullup changes for RC3:

  • KML Examples broken (Closes #1001)
  • drag handler doesn't reset properties on left or improperly modified mousedown (Closes #1003)
  • Text nodes limited to 4096 in length (Closes #1006)
  • KML/GML Attribute CDATA Parsing (Closes #1007)
  • Control.MousePosition (Closes #1008)
Note: See TracTickets for help on using tickets.