大小限制的JavaScript [节点] .nodeValue领域? [英] Size limit to javascript [node].nodeValue field?

查看:98
本文介绍了大小限制的JavaScript [节点] .nodeValue领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Ajax调用接收XML数据。其中一个标签有大量的文字,大约4000-5000字。在Firefox中,该领域正在被截断围绕第3000字符。大多数的一切,我发现在网上说,有没有限制的节点值的大小,但有时它的实现依赖 - 没有坚实的答案。

I'm receiving XML data via an AJAX call. One of the tags has a large amount of text, roughly 4000-5000 characters. In Firefox, the field is being truncated around the 3000th character. Most everything I've found online says there is no limit to node value sizes, but sometime it's implementation dependent - no solid answers.

有没有人有这可能是为什么发生的任何建议,假设有对的nodeValue的大小没有限制?如果有任何解决方法呢?

Does anyone have any suggestions for why this might be occurring, assuming there is no restriction on the size of the nodeValue? Any workarounds if so?

<test>
  <foo>very long string...</foo>
</test>

value = testTag.getElementsByTagName("foo").item(0).firstChild.nodeValue;

值将被截断。

value is truncated.

- 如果我打印xmlHttp.responseText,全部来自被打印的数据。

-If I print the xmlHttp.responseText, all of the data from is printed.

推荐答案

检查这个。它说:

另外,值得注意的是,虽然规格说,标签之间存在无论多少文字,它都应该在一个文本节点,在实践中,这是情况并非总是如此。在Opera 7-9.2x和Mozilla / Netscape 6以上,如果文本是不是特定的最大尺寸,它被分成多个文本节点,这些文本节点将相邻的父元素的子节点集合。

"Also important to note is that although the specifications say that no matter how much text exists between tags, it should all be in one text node, in practice this is not always the case. In Opera 7-9.2x and Mozilla/Netscape 6+, if the text is larger than a specific maximum size, it is split into multiple text nodes. These text nodes will be next to each other in the childNodes collection of the parent element."

这篇关于大小限制的JavaScript [节点] .nodeValue领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆