怎么加大XMLDOM的读取量

allforly 2003-01-15 03:07:16
我用xmlhttp上传文件,当文件大小超过180KB的时候,服务器端的XMLDOM在load的时候就会出错,请问这问题怎么解决呢?
...全文
71 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
allforly 2003-05-11
  • 打赏
  • 举报
回复
揭帖
allforly 2003-01-17
  • 打赏
  • 举报
回复
除了SAX就没别的办法吗,我的空间权限很少的,放个sax上去是不可能的
孟子E章 2003-01-15
  • 打赏
  • 举报
回复
When Should I Use SAX?

As an events-based parser that processes documents in a serial manner, the Simple API for XML (SAX) presents an excellent alternative to the Document Object Model (DOM).

When your documents are large
Perhaps the biggest advantage of SAX is that it requires significantly less memory to process an XML document than the DOM. With SAX, memory consumption does not increase with the size of the file. For example, a 100 kilobyte (KB) document can occupy up to 1 megabyte (MB) of memory using the DOM; the same document requires significantly less memory when using SAX. If you must process large documents, SAX is the better alternative, particularly if you do not need to change the contents of the document.

When you need to abort parsing
Because SAX allows you to abort processing at any time, you can use it to create applications that fetch particular data. For example, you can create an application that searches for a part in inventory. When the application finds the part, it returns the part number and availability, and then stops processing.

When you want to retrieve small amounts of information
For many XML-based solutions, it is not necessary to read the entire document to achieve the desired results. For example, if you want to scan data for relevant news about a particular stock, it's inefficient to read the unnecessary data into memory. With SAX, your application can scan the data for news related only to the stock symbols you indicate, and then create a slimmed-down document structure to pass along to a news service. Scanning only a small percentage of the document results in a significant savings of system resources.

When you want to create a new document structure
In some cases, you might want to use SAX to create a data structure using only high-level objects, such as stock symbols and news, and then combine the data from this XML file with other news sources. Rather than build a DOM structure with low-level elements, attributes, and processing instructions, you can build the document structure more efficiently and quickly using SAX.

When you cannot afford the DOM overhead
For large documents and for large numbers of documents, SAX provides a more efficient method for parsing XML data. For example, consider a remote procedure call (RPC) that returns 10 MB of data to a middle-tier server to be passed to a client. Using SAX, the data can be processed using a small input buffer, a small work buffer, and a small output buffer. Using the DOM, the data structure is constructed in memory, requiring a 10 MB work buffer and at least a 10 MB output buffer for the formatted XML data.
孟子E章 2003-01-15
  • 打赏
  • 举报
回复
When Should I Use DOM?


The following are some suggestions for when to use DOM.

When there is no random access to the document
Because the document is not in memory, you must handle data in the order in which it is processed. DOM is better in this case; SAX can be difficult to use when the document contains many internal cross-references, such as ID and IDREF attributes.

When you want to implement complex searches
It is your responsibility to maintain data structures holding context information that you must retain, such as the attributes of the current element's ancestor.

No SAX implementation in current browsers
SAX support is not built into Microsoft® Internet Explorer.

When you need to perform XSLT transformations
The DOM works better for XSL Transformations (XSLT) where the source XML document is transformed based on the XSLT template applied. For example, to create multiple views of the same data, you must transform it using one of two style sheets. In order for this transformation to take place, you must also create two instances of the DOM. One stores the XML source; the other stores the transformed content.

When you need complex XPath filtering
Use the DOM if you must perform complex XML Path Language (XPath) filtering and retain complex data structures that hold context information. The tree structure of the DOM retains context information automatically. With SAX, you must retain the context information yourself.

When you want to modify and save XML
The DOM allows you to create or modify a document in memory, as well as read a document from an XML source file. SAX is designed for reading, not writing, XML documents. The DOM is the better choice for modifying an XML document and saving the changed document to memory.

When you need random access to data
If random access to information is crucial, it is better to use the DOM to create a tree structure for the data in memory.

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧