been created, but the XML Document Upload process has not been completed1. the XML document has been loaded.2. the XML file has been loaded and is being processed.3. Some XML documents have been parsed.4. The file has been parsed and the client can accept the returned message.
The client receives the response through the attributes of the XMLHTTP object.ResponseText: uses the returned message as a text string;ResponseBody: uses the returned message as the content of the HTML document;ResponseXM
This example includes1. Clients use XMLHTTP to send requests to server Pages2. Server Page background using C # DataSet to implement the operation of the database and get the results3. The client uses the xmldoc to obtain the result which the XMLHTTP returns and carries on the operation to the result
AppendixCommon methods and properties of XMLHTTPCommon methods and properties of XmlDoc
==================
The complete code for the C # XML file Operation class Xmlhelper class:
Using System;
Using System.Collections;
Using System.Xml;
Namespace Com.xmldal
{
public class Xmlhelper
{
#region Public variables
XmlDocument xmldoc;
XmlNode XmlNode;
XmlElement Xmlelem;
#endregion
#region Create an XML document
Create an XML file with a root node
Public bool Createxmldocument (string FileName, String rootname,string Encode)
{
Try
{
The complete code for the class:Using System;Using System.Collections;Using System.Xml;Namespace Keleyi.Com.XmlDAL{public class Xmlhelper{#region Public variablesXmlDocument xmldoc;XmlNode XmlNode;XmlElement Xmlelem;#endregion#region Creating an XML documentCreate an XML file with the root nodepublic bool Createxmldocument (string FileName, String rootname, String Encode){Try{xmldoc = new XmlDocument ();Xml
(node );
// Obtain the specified attribute value of a specified NodeString id = node. Attributes ["id"]. Value;
// Obtain the text in the specified NodeString content = node. InnerText;
// Save the XML fileString path = Server. MapPath ("~ /File/bookstore. xml ");Xml. Save (path );// Or use: xml. Save (HttpContext. Current. Server. MapPath ("~ /File/bookstore. xml "));
II. Specific instance
How to operate XML in C #. netNamespace to be added:Using System. Xml;
Define several public objects:XmlD
-node root for the specified node. appendChild (node); // Obtain the specified attribute value of the specified node string id = node. attributes ["id"]. value; // Obtain the text string content = node in the specified node. innerText; // Save the XML file string path = Server. mapPath ("~ /File/bookstore. xml "); xml. Save (path); // or use: xml. Save (HttpContext. Current. Server. MapPath ("~ /File/bookstore. xml "));
How to operate XML in C #. netNamespace to be added:
Defines several public
);
// Obtain the specified attribute value of a specified NodeString id = node. attributes ["ID"]. value;
// Obtain the text in the specified NodeString content = node. innertext;
// Save the XML fileString Path = server. mappath ("~ /File/bookstore. xml ");XML. Save (PATH );// Or use: XML. Save (httpcontext. Current. server. mappath ("~ /File/bookstore. xml "));
II. Specific instance
How to operate XML in C #. netNamespace to be added:Using system. xml;
Define several public objects:Xmldocumen
. appendchild (node );
// Obtain the specified attribute value of a specified NodeString id = node. attributes ["ID"]. value;
// Obtain the text in the specified NodeString content = node. innertext;
// Save the XML fileString Path = server. mappath ("~ /File/bookstore. xml ");XML. Save (PATH );// Or use: XML. Save (httpcontext. Current. server. mappath ("~ /File/bookstore. xml "));
II. Specific instance
How to operate XML in C #. netNamespace to be added:Using system. xml;
Define sev
);
// Obtain the specified attribute value of a specified NodeString id = node. Attributes ["id"]. Value;
// Obtain the text in the specified NodeString content = node. InnerText;
// Save the XML fileString path = Server. MapPath ("~ /File/bookstore. xml ");Xml. Save (path );// Or use: xml. Save (HttpContext. Current. Server. MapPath ("~ /File/bookstore. xml "));
II. Specific instance
How to operate XML in C #. netNamespace to be added:Using System. Xml;
Define several public objects:XmlDocumen
How to operate XML in C #. netNamespace to be added:Using system. xml;
Define several public objects:Xmldocument xmldoc;Xmlnode;Xmlelement xmlelem;
1. Create an XML file in the directory with the same name as the server:
Method 1:Xmldoc = new xmldocument ();// Add the Declaration section of XML, Xmldeclaration xmldecl;Xmldecl = xmldoc. createxmldeclaration
How to operate XML in C #. netNamespace to be added:Using system. xml;
Define several public objects:Xmldocument xmldoc;Xmlnode;Xmlelement xmlelem;
1. Create an XML file in the directory with the same name as the server:
Method 1:Xmldoc = new xmldocument ();// Add the Declaration section of XMLXmlnode = xmldoc. createnode (xmlnodetype. xmldeclaration ,"",""
Http://weekzero.cnblogs.com/articles/178140.htmlHow to operate XML in C #. netNamespace to be added:Using system. xml;
Define several public objects:Xmldocument xmldoc;Xmlnode;Xmlelement xmlelem;
1. Create an XML file in the directory with the same name as the server:
Method 1:Xmldoc = new xmldocument ();// Add the Declaration section of XML, Xmldeclaration xmldecl;Xmldecl =
Namespace to be added:Using System. Xml;
Define several public objects:XmlDocument xmldoc;XmlNode xmlnode;XmlElement xmlelem;
1. Create an xml file in the directory with the same name as the server:
Method 1:Xmldoc = new XmlDocument ();// Add the Declaration section of XMLXmlnode = xmldoc. CreateNode (XmlNodeType. XmlDeclaration ,"","");
Method One: Build the XML document step-by-step according to the structure of the XML.Implemented through the various classes encapsulated in the namespace "System.Xml" in the. Net FrameWork SDKMethod One: Build the XML document step-by-step according to the structure of the XML.Implemented through the various classes encapsulated in the namespace "System.Xml" in the. Net FrameWork SDKMethod Two: Directly fuser the XML document, and then save to the file.Through the "LoadXml" method in the "XmlD
Operate XML in C #. net// ================================================ ========================================================== ====
How to operate XML in C #. netNamespace to be added:Using system. xml;
Define several public objects:Xmldocument xmldoc;Xmlnode;Xmlelement xmlelem;
1. Create an XML file in the directory with the same name as the server:
Method 1:Xmldoc = new xmldocument ();// Ad
Before starting, create a smallfools. xml file with the following content:
The following operations are performed in the xml file.
Operation 1: Read the entire XML file and display it in the DataGrid:DataSet ds = new DataSet ();Ds. ReadXml (Server. MapPath ("smallfools. xml "));If (ds. Tables. Count> 0){This. DataGrid1.DataSource = ds. Tables [0]. DefaultView;This. DataGrid1.DataBind ();}
Operation 2: obtain the value of the first node
XmlDocument xmlDoc
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.