道路上的非法行为者 [英] Illegal Charaters in path

查看:78
本文介绍了道路上的非法行为者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个小的XML文件,我上传到了一个网页。我有以下

代码将我从web下载的内容转换为xml并且给出了

路径中的非法字符,但是当我尝试查看值时in XML

viewer(通过添加手表)并正确显示内容。


这是代码

...

string b = wc.DownloadString(myurl);

XmlDocument doc = new XmlDocument();

doc.Load(str); < br $> b $ b .....


有人可以告诉我出了什么问题吗?

当我把Load加载到LoadXml时我会得到' '根级别的数据是

无效。第1行,第1位


这是XML

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>

< Files>

< Application key =" one">

< Version> 1.0< /版本>

< /应用程序>

< / Files>

Hi,

I have a small XML file, I uploaded to a web page. I have the following
code to convert the content I downloaded from web to xml and is giving
"Illegal characters in path", but when I try to see the value in XML
viewer (through add watch) and is showing the content correctly.

Here is the code
...
string b = wc.DownloadString(myurl);
XmlDocument doc = new XmlDocument();
doc.Load(str);
.....

Could someone tell me what is wrong?
When I change the Load to LoadXml I get ''Data at the root level is
invalid. Line 1, position 1"

Here is the XML
<?xml version="1.0" encoding="utf-8" ?>
<Files>
<Application key="one">
<Version>1.0</Version>
</Application>
</Files>

推荐答案




你确定用@开始你的琴弦?


(我们看不到你的任何东西)不接受的字符串)


Cor


" DBC User" < db ***** @ gmail.comschreef in bericht

news:11 ********************* @ m73g2000cwd.googlegro ups.com ...
Hi,

You are sure that you start your strings with @?

(we don''t see anything from your string that is not accepted)

Cor

"DBC User" <db*****@gmail.comschreef in bericht
news:11*********************@m73g2000cwd.googlegro ups.com...




我有一个小的XML文件,我上传到网页。我有以下

代码将我从web下载的内容转换为xml并且给出了

路径中的非法字符,但是当我尝试查看值时in XML

viewer(通过添加手表)并正确显示内容。


这是代码

..

string b = wc.DownloadString(myurl);

XmlDocument doc = new XmlDocument();

doc.Load(str);

....


有人能告诉我出了什么问题吗?

当我将Load更改为LoadXml时,我得到''数据在根级别是

无效。第1行,第1位


这是XML

<?xml version =" 1.0"编码= QUOT; UTF-8英寸?>

< Files>

< Application key =" one">

< Version> 1.0< /版本>

< /应用程序>

< / Files>
Hi,

I have a small XML file, I uploaded to a web page. I have the following
code to convert the content I downloaded from web to xml and is giving
"Illegal characters in path", but when I try to see the value in XML
viewer (through add watch) and is showing the content correctly.

Here is the code
..
string b = wc.DownloadString(myurl);
XmlDocument doc = new XmlDocument();
doc.Load(str);
....

Could someone tell me what is wrong?
When I change the Load to LoadXml I get ''Data at the root level is
invalid. Line 1, position 1"

Here is the XML
<?xml version="1.0" encoding="utf-8" ?>
<Files>
<Application key="one">
<Version>1.0</Version>
</Application>
</Files>



DBC用户< db ***** @ gmail.comwrote:
DBC User <db*****@gmail.comwrote:

我有一个小的XML文件,我上传到了一个网页。我有以下

代码将我从web下载的内容转换为xml并且给出了

路径中的非法字符,但是当我尝试查看值时在XML中

viewer(通过添加监视)并正确显示内容。
I have a small XML file, I uploaded to a web page. I have the following
code to convert the content I downloaded from web to xml and is giving
"Illegal characters in path", but when I try to see the value in XML
viewer (through add watch) and is showing the content correctly.



你能发一个简短但完整的程序来演示

的问题吗?


http://www.pobox.com/~skeet/csharp/ complete.html 了解详情

我的意思是什么。


-

Jon Skeet - < ; sk *** @ pobox.com>
http://www.pobox .com / ~siget 博客: http://www.msmvps.com /jon.skeet

如果回复小组,请不要给我发邮件

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


嗨Jon,


正如我之前解释的那样。我有一个简单的XML

http:// tamil。 taisukina.com/ServerReferenceTest.xml )只有

一个。我可以在网页上查看xml。但是当我使用

下面的代码时,我得到的是路径中的非法字符。

doc.Load上的消息,我将Load更改为LoadXml然后我收到了错误的root消息。

以下是我可以使代码失败的示例代码。 />
使用System;

使用System.Collections.Generic;

使用System.Text;

使用System.Net;

使用System.Xml;

使用System.Collections;


名称空间xmlreadproblem

{< br $>
class program

{

static void Main(string [] args)

{

尝试

{

WebClient wc =新的WebClient();

wc.Encoding = Encoding.UTF8;

string b =

wc.DownloadString(" http://tamil.taisukina.com/ServerReferenceTest.xml");

wc.Dispose();

XmlDocument doc = new XmlDocument();

doc.Load(b);

}

catch(异常) e1)

{

string t = e1.ToString();

// TODO:使异常更具体

}

}

}

}


感谢您的时间。

Jon写道:
Hi Jon,

As I explained before. I have a simple XML
(http://tamil.taisukina.com/ServerReferenceTest.xml) which has only
one. I am able to view the xml on the web page. But when I use the
following code, I am getting "Illegal charaters in path" message on
doc.Load, I changed the Load to LoadXml then I get bad root message.
Here is the sample code where I can make the code fail.
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Xml;
using System.Collections;

namespace xmlreadproblem
{
class Program
{
static void Main(string[] args)
{
try
{
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string b =
wc.DownloadString("http://tamil.taisukina.com/ServerReferenceTest.xml");
wc.Dispose();
XmlDocument doc = new XmlDocument();
doc.Load(b);
}
catch (Exception e1)
{
string t = e1.ToString();
//TODO: Make exception more specific
}
}
}
}

Thanks for your time.
Jon wrote:

DBC用户< db ***** @ gmail.comwrote:
DBC User <db*****@gmail.comwrote:

我有一个小的XML文件,我上传到一个网页。我有以下

代码将我从web下载的内容转换为xml并且给出了

路径中的非法字符,但是当我尝试查看值时在XML中

viewer(通过添加监视)并正确显示内容。
I have a small XML file, I uploaded to a web page. I have the following
code to convert the content I downloaded from web to xml and is giving
"Illegal characters in path", but when I try to see the value in XML
viewer (through add watch) and is showing the content correctly.



你能发一个简短但完整的程序来演示

的问题吗?


http://www.pobox.com/~skeet/csharp/ complete.html 了解详情

我的意思是什么。


-

Jon Skeet - < ; sk *** @ pobox.com>
http://www.pobox .com / ~siget 博客: http://www.msmvps.com /jon.skeet

如果回复该群组,请不要给我发邮件


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


这篇关于道路上的非法行为者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆