473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem reading large amount data from xml tag

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. I can't find any
references to xml size limits, but I am definitely losing data.
Creating large javascript variables is not a problem, I can do that.
Any help is appreciated.

Apr 21 '06 #1
4 6669
loretta wrote:
I have data within an xml tag that is being truncated when being read
into a javascript variable.
Within a start-tag or an end-tag?

If you think that tags are the same thing as elements, you may already
be having trouble (see http://xml.silmaril.ie/authors/makeup/)
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. I can't find any
references to xml size limits, but I am definitely losing data.
Creating large javascript variables is not a problem, I can do that.


The XML standard imposes no limits on the length of character data
that may be contained in an element, nor on the length of the data
in an attribute value. In practice, different operating systems and
different application software will have their own limits, possibly
connected to external restrictions like the amount of physical memory
in the machine, possibly due to historical (inherited) practices, or
(at worst) just sloppy programming or badly-specified systems.

When I see values like 4k or 32k I immediately smell a rat :-)

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Apr 23 '06 #2
Standard reminder: If you're working with SAX, remember that SAX may
break text content across several successive calls to characters().
Failing to allow for this may be the single most common XML programming
mistake.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
Apr 24 '06 #3


loretta wrote:
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.

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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Apr 24 '06 #4
Martin Honnen wrote:
Mozilla's XML parser is known to create a single text node for each
chunk of 4096 characters


If so, they're doing some slightly sloppy buffer management.

SAX is expected to divide text up wherever's convenient for the parser's
input buffers, since SAX was theoretically intended to be a thin layer
between the parser and application. (It should be even thinner, but it's
a bit late to argue about that now.)

But DOM Level 1 Core's description of Text nodes, reiterated in Level 2
and Level 3, says "When a document is first made available via the DOM,
there is only one Text node for each block of text." So it's surprising,
disappointing, and annoying that Mozilla isn't honoring that expectation.

Ignoring this requirement may be giving them a bit of a performance
boost. And well-written DOM code should be able to deal with it,
especially since parsers which retain CDATA-section boundaries will have
intermixed Text and CDATASection nodes which can cause similar hassles.
So if they wanted to offer this as an _optional_ mode, I wouldn't
complain... But if they aren't defaulting to delivering the document in
single-node-per-text-block form, they really aren't fully conforming to
the spec.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Apr 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ohaya | last post by:
Hi, I'm a real newbie, but have been asked to try to fix a problem in one of our JSP pages that is suppose to read in a text file and display it. From my testing thus far, it appears this page...
2
by: steve | last post by:
Hi, I have researched but have not found a good solution to this problem. I am importing large amounts of data (over 50 Meg) into a new mysql db that I set up. I use >mysql dbname <...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
16
by: Jack | last post by:
I need to process large amount of data. The data structure fits well in a dictionary but the amount is large - close to or more than the size of physical memory. I wonder what will happen if I try...
11
by: nartla | last post by:
Hello, I work on an app developped with Access/VBA and communicating with a SQL Server database via ODBC. My problem is that I have to manage a big string which can be 0 to 1024 characters...
3
by: Man Nguyen | last post by:
Hi, I am using C# to read large FoxPro data file (DBF). Everything works fine except it is too slow to load the file in buffer (I think). Anybody know how to solve this problem please instruct...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.