


Detailed introduction to using XMLHTTP to send extremely long XML form data
When sending a large amount of xml to your IIS server as part of the POST data - such as in the TEXTAREA of an asp form - you may get some unexpected results. When the data is processed on the server, you may end up encountering errors due to the way you process the data. The reason is that when you submit data back to the server, there is a (data) size limit in the POST field. The purpose of this is to prevent possible intruders from sending an extremely large amount of data to the server in a denial of service (DoS) attack.
This restriction also limits your ability. But there are ways around this problem. If you are not limited to sending data via FORM submission, then you can use the xmlhttp object (a DOM object in Microsoft's XML set) to send the required XML:
var oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); oXMLHTTP.open("POST", "xml_handler.asp", false); oXMLHTTP.send(xml_to_send);
Since the Request object implements the IStream interface, you can load the XML to be submitted by using the load() method of the DOMDocument object:
Dim oDOM Set oDOM = Server.CreateObject("MSXML2.DOMDocument") oDOM.load Request
If You are limited to only submitting using FORM, so you can overcome this limitation by submitting multiple TEXTAREA or INPUT. The first two can be reassembled together as soon as the server receives the FORM data:
var MAXLEN = 90000; var oForm = document.createElement("FORM"); oFORM.method = "POST"; oFORM.action = "xml_handler.asp"; oFORM = document.body.appendChild(oFORM); var s = document.someForm.txtXML.value; if (s.length > MAXLEN) { while (s.length > MAXLEN) { var o = document.createElement("INPUT"); o.type = "hidden"; o.name = "txtXML"; o.value = s.substr(0, MAXLEN); oFORM.appendChild(o); s = s.substr(MAXLEN); } var o = document.createElement("INPUT"); o.type = "hidden"; o.name = "txtXML"; o.value = s.substr(0, MAXLEN); oFORM.appendChild(o); } else { var o = document.createElement("INPUT"); o.type = "hidden"; o.name = "txtXML"; o.value = s; oFORM.appendChild(o); }
This code will create a new FORM element to handle the submission of data and place it in the BODY element. It then checks the length of the XML that is about to be submitted to the server. This XML resides in a TEXTAREA called txtXML inside someForm.
If the XML is larger than the 90,000-character MAXLEN, then this code will create multiple hidden INPUT elements and set the value attribute to the 90,000-character XML data, or set to a value at the end of the XML to split the data into multiple parts. If the size of this XML is less than MAXLEN, then this code will just create an INPUT and set the value accordingly. This data is then submitted to the server for processing.
You may have noticed that I assigned the same name - txtXML - to each field of the new form. This will help separate the XML data from other data that may be submitted, and provide an easy way to reorganize the XML data. When reorganizing the data, you need a simple loop to connect the data in the fields:
Dim str, fld For Each fld In Request.Form("txtXML") str = str & fld Next
Since a fieldset has been created for each FORM element, so You can iterate over fields with the same name. As long as you create FORM elements on the client side in the proper order, you don't need to worry about the order in which the fields are traversed. This can be easily accomplished through FORM's appendChild() method.
Data is submitted from left to right and top to bottom on the client side, so when you append the INPUT element to the end of the FORM element, it will always Data is received in the same order.
If you are looking to implement a large data solution, such as transferring large amounts of Excel data from the client machine to the server, then you should reconsider whether to use FORM submission, or to transfer the data logically Divide into smaller parts. Since you cannot use the file type INPUT element, the most creative solution is to convert the data to XML locally and then submit the XML data to the server. In turn, the data is stored on the server until further processing is required.
Of course, there may be better ways to handle this problem. But when you don't have much time, all you need is a quick, usable solution.
The above is a detailed introduction to using XMLHTTP to send ultra-long XML form data. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The speed of mobile XML to PDF depends on the following factors: the complexity of XML structure. Mobile hardware configuration conversion method (library, algorithm) code quality optimization methods (select efficient libraries, optimize algorithms, cache data, and utilize multi-threading). Overall, there is no absolute answer and it needs to be optimized according to the specific situation.

It is impossible to complete XML to PDF conversion directly on your phone with a single application. It is necessary to use cloud services, which can be achieved through two steps: 1. Convert XML to PDF in the cloud, 2. Access or download the converted PDF file on the mobile phone.

It is not easy to convert XML to PDF directly on your phone, but it can be achieved with the help of cloud services. It is recommended to use a lightweight mobile app to upload XML files and receive generated PDFs, and convert them with cloud APIs. Cloud APIs use serverless computing services, and choosing the right platform is crucial. Complexity, error handling, security, and optimization strategies need to be considered when handling XML parsing and PDF generation. The entire process requires the front-end app and the back-end API to work together, and it requires some understanding of a variety of technologies.

XML formatting tools can type code according to rules to improve readability and understanding. When selecting a tool, pay attention to customization capabilities, handling of special circumstances, performance and ease of use. Commonly used tool types include online tools, IDE plug-ins, and command-line tools.

An application that converts XML directly to PDF cannot be found because they are two fundamentally different formats. XML is used to store data, while PDF is used to display documents. To complete the transformation, you can use programming languages and libraries such as Python and ReportLab to parse XML data and generate PDF documents.

To open a web.xml file, you can use the following methods: Use a text editor (such as Notepad or TextEdit) to edit commands using an integrated development environment (such as Eclipse or NetBeans) (Windows: notepad web.xml; Mac/Linux: open -a TextEdit web.xml)

There are three ways to convert XML to Word: use Microsoft Word, use an XML converter, or use a programming language.

Use most text editors to open XML files; if you need a more intuitive tree display, you can use an XML editor, such as Oxygen XML Editor or XMLSpy; if you process XML data in a program, you need to use a programming language (such as Python) and XML libraries (such as xml.etree.ElementTree) to parse.
