How to read an xml file using Silverlight using c#? - silverlight-4.0

I am trying to figure out if there is a way to read xml file (like c:\test.xml) in silverlight application? All I want is to read xml file into xmldocument. any help?
I have a text box from where I read xml file path. Now I want to read that xml into xmldocument

As the link that Russ provided mentions, you can't directly access a file on the hard drive with Silverlight. Typically you need to use the OpenFileDialog to retrieve the file stream. However if your Silverlight application is an Out-Of-Browser application with Elevated Permissions then you do have access to the user's Documents folder.
Also, XmlDocument is not available in Silverlight. You'll want to use the XDocument class, which is the newer way to work with XML in the latest versions of .NET.
Here's an example of using XDocument, in relation to XmlDocument:
http://blogs.msdn.com/b/xmlteam/archive/2009/03/31/converting-from-xmldocument-to-xdocument.aspx
MSDN Docs on XDocument:
http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument(v=VS.95).aspx

Related

SenseNet :: File System Blob

We are trying to create custom blob using the sample provided by Sensenet on wiki http://wiki.sensenet.com/How_to_create_an_external_blob_provider ,
But we found there is an object not exist “FileSystemChunkReaderStream” so we are not able to continue practicing how to work with blobs.
Can you please share with us this class FileSystemChunkReaderStream ?
Currently the Reader and Writer stream classes can be found in the Tests project along with the file system blob provider sample. Although if you are using the Community edition, you'll have to wait a bit for the new release because it is behind the Enterprise edition.
In the meantime, please check the wiki link you posted above, I added the two missing stream classes to the article so that you can continue with your project.
How to create an external blob provider

How do I assign a URL to a file stored in a SQL database?

I have a self-made document management system that stores files of all sorts in an SQL database. The database stores 4 basic rows of information, namely:
FileID
FileName
FileSize
FileType
FileContent
I want to use viewer.JS to preview files, but it requires that I have a URL to access my file, and I have no idea how to assign a URL that would access a file of my choice in a row in a database. I'm building on a home-grown PAAS, thats built on .net.
I've heard that the URL rewrite module for IIS (I'm on 7) may solve my problem, but cant seem to crack it.
Any help on my problem would be much appreciated.
IMHO IIS rewrite would not help you. Assuming you're using .net, you'd need to build a simple website and use routing in a view.
The url could be something like /Document/{fileid}. when this path is encountered, the router would call your view and you can return the file's content.
Store file in SQL Server database using .Net MVC3 with Entity Framework has some info on a model/controller.
Note: There are some security issues with this approach.

Populate SWF with SQL data

I designed a Flash application that takes data from an XML file and populates a datagrid and textFields.
I need to access a SQL database instead of XML.
Can you lead me in the right direction? I have seen Flash Builder access SQL, but I am not sure how to populate the datagrid in the SWF. The SWF contains a map and other graphic elements and animation.
Thanks.
Simple answer is that you create a PHP file that accesses the database and prints/echoes the MYSQL data as your XML. Using the URLLoader class you can load this php file and have the xml as the loaded data. The rest should then be the same as your existing app.
You can add get variables to the url string used in the URLLoader or you can use URLVariables to use post variables to pass values if necessary to your php script.

stream varbinary PDF file from SQL 2005 to browser using ASP

I have a commercial program that stores PDF files to SQL 2005. I would like to be able to search for (I have that part) and then display the PDF file in a browser. It's the 'display the PDF file' that I'm having trouble with. I am using HTTP/ASP and would prefer to continue that way. I don't know anything about ASP.NET, so that would not be helpful to me. Any help would be appreciated. Thanks.
The best option here is to implement a HttpHandler that fetches the binary data from your database and outputs it to the response stream. This is the most efficient method available in ASP.Net.
There are many questions about HttpHandlers on SO, so implementing one should be easy: https://stackoverflow.com/questions/tagged/httphandler
One thing you should be aware of is that you should set the correct content type so that the browser recognices the pdf document.

Method to generate pdf from access+vb6 or just sql 2005?

The setup:
Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf.
The only way I can think of is send a request from access to the sql server for a web page. Something like:
"http://sqlserver/generatepdf.php?id=123"
I'm trying to avoid the web page 'middle man'. Is there a way to generate the pdf in T-SQL? Anyone have any other ideas. I'm not looking for code, just methdology ideas.
Thank you
Save the form as a report, then use Access MVP Stephen Lebans free A2000ReportToPDF utility to convert it to a pdf file.
http://www.lebans.com/reporttopdf.htm
If they have Access 2007 they can download and install the free Microsoft Office 2007 Add-in to save documents as PDF or XPS.
http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
Microsoft's ReportViewer client can generate pdfs natively.
It works inside of web pages and windows forms/wpf apps. You can programmatically trigger the export as well. The only downside is that you'll need to basically redo your form as a report.
I must admit that I did not get it: you want to export an Access form and its data into a PDF file? Your form is basically graphics, not text, nor report. Do you mean that you want this form to be included as (for example) a .png file inside a PDF file or do you want it to be a full PDF file inheriting objects from the original form and allowing things such as text search and so on?