views:

870

answers:

5

is it possible to write xml in silverlight with vb

+1  A: 

Yes, you can write Silverlight applications and web pages using VB(.NET), and they can save XML files, but they're going to be constrained by the security/sandboxing with Silverlight.

So, you can do it but you have to use the isolated storage stuff.

http://www.danielmoth.com/Blog/2008/04/isolatedstorage-in-siverlight-2-beta-1.html

I apologize that this answer isn't better, so I'm marking it community wiki.

Mark Allen
+2  A: 

Yes you can write XML in silverlight. Silverlight's System.Xml dll supports XmlWriter which allows you to write XML to a Stream, TextWriter or a StringBuilder.

If you are looking for standard XML DOM implementation you won't find it, Silverlight does not have that nor does it have XPath. Instead if you are looking to build an XML document in memory you can use System.Xml.Linq. Use the XDocument, XElement and XAttribute to create your document.

AnthonyWJones
Daniel Elliott
+1  A: 

In my application the model layer is XML based, I use LINQ To XML (supported by SL) pretty good stuff (if you are handling XML that are bellow some Mb, it's like DOM builds up the tree in memory).

On the other hand to store the XML in the isolated storage, or in the server I just convert the XML into an string, quite standard param :), only take care when using services to configure the params tu support more than 64 K's string parametrs (if you are in that case).

HTH Braulio

Braulio
+1  A: 

Other users have covered the actual writing of physical XML so please refer to their answers for that.

I was wondering though, are you talking about VB XML literals? If so, then yes it's possible to use VB XML literals in a Silverlight App. This extends to the use of XML literals and XLINQ.

JaredPar
A: 

For example you can easy create XML from object using XMLSerialization.

FFire