我知道这个问题很多。但我无法找到相关信息。
我在scala中将字符串传递给userdefined函数。 字符串看起来像这样
<p>I want to use a track-bar to change a form's opacity.</p>
<p>This is my code:</p>
<pre><code>decimal trans = trackBar1.Value / 5000;
this.Opacity = trans;
</code></pre>
<p>When I build the application, it gives the following error:</p>
<blockquote>
<p>Cannot implicitly convert type 'decimal' to 'double'.</p>
</blockquote>
<p>I tried using <code>trans</code> and <code>double</code> but then the
control doesn't work. This code worked fine in a past VB.NET project. </p>
,While applying opacity to a form should we use a decimal or double value?
我的用户定义函数如下所示
case class bodyresults(text:String,code:String)
val bodyudf = udf{ (body: String) =>
//Appending body tag explicitly to the xml before parsing
val xmlElems = xml.XML.loadString(s"""<?xml version="1.0" encoding="utf-
8"?> <!ENTITY nbsp " "> <body> ${body} </body>""")
// extract the code inside the req
val code = (xmlElems \\ "body" \\ "pre" \\ "code").text
val text = (xmlElems \\ "body").text.replaceAll(s"${code}" ,"" )
bodyresults(text, code)
}
导致错误定义但未声明。所以我附上了。现在它的原因
Error:The markup in the document preceding the root element must be well-formed
请让我知道我做错了什么。