在 C# 中传递一个字符串
Pass a string in C#
我试图通过 C# 代码传递此字符串但失败了:
soap:Body1479374
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.LoadXml(字符串);
试图发送整个和 3 个部分,但在 Sectiona
内失败
string Sectiona = @"soap:Body";
string Sectionb = "1479374";
string Sectionc = "";
字符串数据 = Sectiona + Sectionb + Sectionc;
你的皂体标签有误。使用 xml linq :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string xml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>1479374</soap:Body></soap:Envelope>";
XDocument doc = XDocument.Parse(xml);
}
}
}
我试图通过 C# 代码传递此字符串但失败了:
System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.LoadXml(字符串);
试图发送整个和 3 个部分,但在 Sectiona
内失败string Sectiona = @"
string Sectionb = "1479374";
string Sectionc = "";
字符串数据 = Sectiona + Sectionb + Sectionc;
你的皂体标签有误。使用 xml linq :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string xml = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>1479374</soap:Body></soap:Envelope>";
XDocument doc = XDocument.Parse(xml);
}
}
}