English 中文(简体)
使用Silverlight根据XSD验证XML?
原标题:Validating XML against XSD using Silverlight?

因此,我一直在处理一个个人项目,将我的garmin gps数据导入本地数据库。数据位于GPX xml文件中,该文件的模式由xsd文件定义。

这个想法是让客户端上传他们的GPX文件,SL客户端在将其发送到服务器之前对其进行验证。但我在这里遇到了一些问题,首先,silverlight似乎无法根据xsd验证xml。

首先,这是真的吗?还是我还没有弄清楚如何在客户端进行验证?我已经在服务器端(一个常规类库)编写了代码,但如果我试图将其移动到客户端,则此代码不会在客户端编译。关于的错误无法使用新的XmlSchemaSet();因为它是一个私有构造函数。

其次,假设我确实必须在服务器端进行验证,那么如何使用RIA向客户端返回信息性错误?

问题回答

您可以设置一个页面方法,并通过ajax调用javascript返回来隐藏一些错误文本。

http://forums.silverlight.net/forums/p/199354/477971.aspx

希望有帮助

Silverlight does not support XML validation against XSD. According to MSDN, the XmlSchemaSet class is provided only for interface compatibility.

所以唯一的解决方案是

  1. Either send the XML file to be validated in the server
  2. Or implement your custom validator in the client side manually.




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签