我收到此错误,到目前为止,我发现的只是“删除空间”,但没有空间。我发现这是一个脚本,可以从任何文件格式中提取履历并提取数据(解析)以便将其放入SQL数据库中……还没有到那一步
ASP.net代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ResumeParser.aspx.cs" Inherits="CsharpSamCodeResumeParser_USAResume" Debug="true" ValidateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 574px; height: 95px">
<tr>
<td style="width: 507px">
Resume
URL</td>
<td style="width: 737px">
<asp:TextBox ID="TxtUrl" runat="server" Width="424px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Resume parser" /></td>
</tr>
</table>
<table>
<tr>
<td style="width: 247px; height: 287px">
PARSING RESULTS</td>
<td style="width: 568px; height: 287px">
<asp:TextBox ID="TxtOutput" runat="server" Height="276px" TextMode="MultiLine" Width="565px"></asp:TextBox></td>
</tr>
</table>
</div>
</form>
C#:
public partial class CsharpSamCodeResumeParser_USAResume : System.Web.UI.Page
{
//////////Configuration Setting///////////////////
string ServiceUrl = (string)ConfigurationSettings.AppSettings["webServiceUrl"];
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
///////////////////Variable Start///////////////
string url = TxtUrl.Text;
StringBuilder strRequest =new StringBuilder();
string userkey = (string)ConfigurationSettings.AppSettings["userKey"];
string version = (string)ConfigurationSettings.AppSettings["Version"];
string countryKey=(string)ConfigurationSettings.AppSettings["CountryKey"];
/////////////////Variable End///////////////////
strRequest.Append("<?xml version='1.0' encoding='utf-8'?>");
strRequest.Append("<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>");
strRequest.Append("<soap:Body>");
strRequest.Append("<ParseResume xmlns='http://tempuri.org/'>");
strRequest.Append("<url>" + url + "</url>");
strRequest.Append("<key>" + userkey + "</key>");
strRequest.Append("<version>" + version + "</version>");
strRequest.Append("<countryKey>" + countryKey + "</countryKey>");
strRequest.Append("</ParseResume>");
strRequest.Append("</soap:Body>");
strRequest.Append("</soap:Envelope>");
///////////////SOAP XML END///////////////////
/////////////////XML PROCESSED//////////////////////
byte[] byteArray = Encoding.ASCII.GetBytes(strRequest.ToString());
HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(ServiceUrl);
httpRequest.Credentials = CredentialCache.DefaultCredentials;
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml";
httpRequest.ContentLength = byteArray.Length;
Stream dataStream = httpRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
/////////////////////PROCESS END////////////////
//////////////////RESPONSE RECEIVED///////////////////////
HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse();
StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string ack = string.Empty;
//ack = streamReader.ReadToEnd().ToString();
////////////////////GET NODE VALUE FROM RESPONSE XML/////////////
using (XmlReader reader = XmlReader.Create(streamReader))
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
for (int count = 1; count <= reader.Depth; count++)
{
if (reader.Name == "ParseResumeResult")
{
ack = reader.ReadElementContentAsString();
}
}
}
}
TxtOutput.Text = ack;
}
/////////////////API CALL PROCESS END///////////////////
}
}
参考方案
我怀疑这是因为您是通过字符串串联创建xml文档的,所以您无意中从其中一个变量中添加了格式错误的xml。也许其中一个具有小于号,这导致Xml解析器爆炸。您应该尝试通过DOM创建文档,或者可能使用CDATA部分作为可配置值。
string url = TxtUrl.Text;
string userkey = (string)ConfigurationSettings.AppSettings["userKey"];
string version = (string)ConfigurationSettings.AppSettings["Version"];
string countryKey=(string)ConfigurationSettings.AppSettings["CountryKey"];
strRequest.Append("<url>" + url + "</url>");
strRequest.Append("<key>" + userkey + "</key>");
strRequest.Append("<version>" + version + "</version>");
strRequest.Append("<countryKey>" + countryKey + "</countryKey>");
我会尝试将strRequest
StringBuilder写入文件,然后仅在xml编辑器中将其打开,并找出问题所在。
我是PHP的新手,正在尝试使用Datatables jQuery插件。我知道我必须从.php文件中获取数据,然后在数据表中使用它,但是我似乎无法通过ajax将其传递给数据表。我设法从数据库中获取数据,并对其进行json编码,但是后来我不知道如何在我的index.php文件中调用它,并在其中显示它。我究竟做错了什么?这是我的代码:HTML(已编辑): <…
如何在没有for循环的情况下在Javascript中使用Django模板标签 - javascript我想在JavaScript中使用模板变量:我的问题是在javascript代码中使用for循环,for循环之间的所有事情都会重复..但我不想要....下面粘贴了我的代码..有人可以告诉我更好的方法吗这..因为这看起来很丑..这是我的代码: {% block extra_javascript %} <script src="/static/js…
Web服务错误“提供的URI方案'http'无效;预期为“ https”。” - c#我有一个导致以下错误的服务呼叫:“提供的URI方案'http'无效;应为'https'。”app.config值:<basicHttpBinding> <binding name="xx_xxxxx_spcName" closeTimeout="00:01:00" openTimeout="…
Mongo抛出“元素名称'名称'无效”异常 - c#我正在更新一个简单的字段。var filterDocument = new BsonDocument { { "name", "alice" } }; var newDocument = new BsonDocument { { "name", "Alice" } }; coll…
T-SQL等价的正则表达式'\ b' - c#我正在将利用regex的CLR函数转换为SQL函数。我知道SQL Server并不完全支持正则表达式,但是我只需要一种情况就可以搜索单词。搜索字段值:{"Id":1234, "Title": "The quick brown"}.NET中的正则表达式模式:'\b' + '…