[ka-Map-users] kaXmlOverlay
Pg
pg.navone at gmail.com
Mon Feb 12 16:09:28 EST 2007
Googleing on the topic I've just found this hint:
[-- cite --]
> I have data within an xml tag that is being truncated when being read
> into a javascript variable. On Firefox, I am only getting up to 4096
> characters. On IE, I am getting 31324 characters. I can view the xml
> source, all the data is there. I am using javascript function
> getElementsByTagName to read the data from the tag and then the
> firstChild and nodeValue notations to get the data.[/color]
Mozilla's XML parser is known to create a single text node for each
chunk of 4096 characters so there you will certainly encounter the
problem. The data is not lost however, you will simply end up with an
element in the DOM that has several text child nodes.
Workarounds are using e.g.
xmlDocument.getElementsByTagName('tagname')[0].textContent
instead of accessing firstChild and its nodeValue or to force
normalization of the XML document by calling
xmlDocument.normalize()
first, then you can access firstChild.nodeValue as adjacent text nodes
have been merged into one node.
Note that the textContent property is part of W3C DOM Level 3 and only
newer Mozilla versions support that property.
[-- end cite --]
I will try, but not immediatly. The idea is to change the line:
text = domElement.firstChild.data;
in method kaXmlFeature.prototype.parseElement
2007/2/11, Ionut Muntean <ionut at muntean.ro>:
>
> Thank's Pg.
>
> This was the problem. The XML parser cannot handle the length of the
> linestring definition. I've splitted the linestring definition into more
> linestrings and everything is working ok now.
>
> Now, for programatically build linestrings, is there any possibility to
> "grow" the linestring? I want to plot the track of a vehicle.
>
> / IM
>
>
>
> Pg wrote:
> > The example is not fully accessible.
> >
> > In any case the error is apparently due to the length of the line: the
> > XML parser truncates the coordinates text.
> > I don't know how to correct this problem.
> >
> > I can suggest a workaround: split the linestring in more chunks.
> >
> > - Pg
> >
> > 2007/2/10, Ionut Muntean <ionut at muntean.ro <mailto:ionut at muntean.ro>>:
> >
> > With only the point (icon) everything is ok. Please try
> > http://eos.mitechnologies.ro as example
> >
> > Pg wrote:
> > > I haven't other ideas.
> > > I use the same environment for long lines, and it works.
> > >
> > > Do you have an example accessible on internet?
> > >
> > > If not could you check (e.g. with an alert or with FireBug) if
> the
> > > return value of the function _BrowserIdent_newCanvas() is valid
> > or is null?
> > >
> > > If you plot only the bullet ("Auto 1" in your XML), does it
> works?
> >
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ka-Map-users mailing list
> > ka-Map-users at lists.maptools.org
> > http://lists.maptools.org/mailman/listinfo/ka-map-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ka-map-users/attachments/20070212/f391b650/attachment.html
More information about the ka-Map-users
mailing list