Use XSD file in XBAP application - wpf

In an existing Winforms application, I receive XML formatted data from a database query, and use a local XSD file to parse the resulting XML element.
Now, I'd like to achieve the same from within a WPF XBAP (application in browser), so no local XSD file is accessible.
Obviously I can load the XSD file onto my web server, but how do I tell WPF to use this schema file for parsing the XML chunk?

Use XmlnsDefinition and XmlnsPrefix assemblies to map the XSD file to page element or XML root element.

Related

Is it posssible Browser Automation Studio auto fill?

We have a database which type is Json file.
We need to read data from Json file to add this file in our web site
(Our web site view like as in the below picture).
Is it posssible to this process with BAS(Browser Automation Studio)?
Our data is dynamic.
Yes it is possible. You can use "type text"

Adding .xml file into a dnn page

i have a default.aspx page that contains details from link.xml file.The data for the default.aspx page comes from a links.xml file. I want to migrate the default.aspx page to dnn. That is i need to include the data of the .xml file to the dnn page. I tried uploading the .xml file to the file manager and then importing the content to the module but it didn't work.
could you please help me with any module that helps me add the data of the xml to it.or any other way where i can add the data from the xml file.
You can do a couple of things to use XML in DNN.
1) Download/install the XML module, then point that module to your XML file.
2) Create a custom module that reads from the XML file.
I personally would go with #2 because building modules can be very easy and great development practice to learn the DNN platform.

Resource File Links

When you create a Silverlight Business Application you get a Silverlight application and a Web application. In the Web/Resources folder of the Silverlight app there are links to the files in the Resources folder of the Web app. These links are exactly like the files they link to in that they are heirarchical with the Resource.Designer.cs file shown as a code-behind file for the Resource.resx file
When I try to link to a Resource file in this way I only get the .resx file unless I link to the .Designer.cs file separately. However in this case the Designer.cs file is then shown as a standard code file and not related to the .resx file.
Does anyone know how to do this linking correctly?
After you add a link to new resource file without *.Designer.cs, set its property "Custom Tool" ("PublicResXFileCodeGenerator").

How can I show folder and its subfolders from server to Silverlight application in TreeView?

How can I show folder and its subfolders from server to Silverlight application in TreeView?
You would need to add support for this on the server side. Either:
Add a web service that safely returns the folder and subfolders and files
Have the web page that the Silverlight plugin is in add this information into the HTML of the page (that can be read like an XML island) or the initParams of the object tag.
There is no way to do this in just the client.

Localization of error message in Validation silverlight

I want to use localization feature for Validation messages, for eg-
[Required(ErrorMessageResourceName = "RequiredField", ErrorMessageResourceType = typeof( ))]
public string someText
{ get... set...}
I'm using MVVM pattern so this property is in my model(its a differnt project inside same solution of silverlight) and all my localization resources are in the App.current.Resources. How can I set the ErrorMessageResourceType to my App resources?
Please suggest.
Thanks in advance
Sai
Well apparently Localization of error messages isnt as straightforward. You are supposed to add a resource file to the MyApp.Web project, that is the asp.net site that hosts your silverlight app, then add that resource to the silverlight app, then you will be able todo the code you stated in your question after some tweaks, follow the instructions below
This section explores how error
messages can be localized by storing
them in resource files and sharing
them across tiers.
The example uses .NET RIA Services
walkthrough project as the base
project and builds on top of it.
Let's say we want to add a validation
error as a resource for LoginID field.
Create a new ‘Resources' folder in the HRApp.Web project
(server project)
Add a new resource file to this folder and name it
ValidationErrorResources.resx
Double click on the .RESX file to bring up resource designer
page
Add a new string resource with Name= LoginIDValidationError and
Value= "LoginID field is required"
Change the access modifier to ‘Public' by clicking on the ‘Access
Modifier' drop down UI and selecting
‘Public' and save the project. This
generates a ValidationErrorResources
class in the HRApp.Web.Resources
namespace.
Open ‘OrganizationService.metadata.cs' file
and add the following ‘Required' field
validation to LoginID member. Specify
the error message resource name and
resource type values by setting the
corresponding attribute members as
shown below.
[Required(ErrorMessageResourceName =
"LoginIDValidationError",
ErrorMessageResourceType =
typeof(ValidationErrorResources))]
public string LoginID;
Now we want to share this resource
file in the Silverlight project
(client project). To do this,
Create a folder Web\Resources in the HRApp project
(folder structure must match the
resource file namespace on the server
side)
Select Resources folder and bring up Add Existing file dialog,
browse to the server side resource
file folder location
Select ValidationErrorResources.resx and
ValidationErrorResources.designer.cs
files, and add them as link files to
the Silverlight project. Save the
project file
Open HRApp.csproj file in notepad , locate the section where
.designer.cs file is included and add
the highlighted 3 lines to this
section
<Compile
Include="..\HRApp.Web\Resources\ValidationErrorResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>ValidationErrorResources.resx</DependentUpon>
<Link>Web\Resources\ValidationErrorResources.Designer.cs</Link>
</Compile>
Save the project file and reload the project in Visual Studio
Build the solution and run
Now whenever the validation fails for
the LoginID field the error message
from the resource file is shown to the
user. The resource file can now be
customized to store locale specific
error messages.
This solution almost worked for me. I had to made some arrangements to work with a data model (edmx) located in one project, DataDomainService (Ria) in other and the Silverlight access layer in other project.
When i compile the HRApp equivalent in my situation, the metadata containing the validation info for some property is not generated. It says that the client has no access to the ValidationErrorResources type. But after following all the instructions mentioned above plus some others to get a correct resource namespace, the client CAN access ValidationErrorResources.
It works if i write it myself to the generated Silverlight class.
So seems like this kind of project separation is not quite supported by the class generator...
But thanks anyway, this post was quite helpful and maybe i'll make it all work in a couple of days.
:D
When I did this recently this thred helped alot: http://forums.asp.net/t/1433699.aspx
In particular "...the resource file must be converter to a class before being able to reference it in the typeof of the ErrorMessageResourceType in the data annotation..."
Also there are a few other useful hits from the main search engines: http://www.liquidjelly.co.uk/supersearch/?q=silverlight%20dataannotations%20localization&lang=en-GB

Resources