本文介绍了Linq to XML需要VB.NET XML文字表达的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有与此问题所述的相同的问题,但可接受的解决方案是可以在我的机器上工作"答案.
I have the same problem as stated in this question, but the accepted solution there was a "works on my machine" answer.
这是我的代码:
Dim document As XDocument = _
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetUser xmlns="http://foo.com/bar.asmx">
<encryptedHash>HashString</encryptedHash>
<accessKey>AccessString</accessKey>
<siteUID>SiteString</siteUID>
</GetUser>
</soap12:Body>
</soap12:Envelope>
然后我收到错误消息:BC30201:需要表达.
And I receive the error: BC30201: Expression expected.
有人对导致这种情况的原因有更详细的了解吗?
Does anyone have a more detailed idea of what could cause this?
推荐答案
好,橡胶鸭子调试-
即使项目设置为以.NET 3.5为目标,但由于缺少web.config的任何原因:
Even though the project was set to target .NET 3.5, for whatever reason the web.config was missing:
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
所以我想它不是在3.5中运行.一旦将以上内容添加到web.config中,便对其进行了编译.
So I guess it wasn't running in 3.5. As soon as I added the above to the web.config it compiled.
这篇关于Linq to XML需要VB.NET XML文字表达的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!