WP7独立存储文件流使用XDocument.Save时添加空格/空值 [英] WP7 Isolated Storage File Stream Adding Spaces/Nulls When using XDocument.Save

查看:41
本文介绍了WP7独立存储文件流使用XDocument.Save时添加空格/空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在VB.net中为WP7应用程序编写一个子程序,该应用程序使用Linq / XDocument在隔离存储中创建XML文件。  XML似乎正在正确创建,但是当我打开文件时,在
最后一个xml标记之后写入大约一百个空格。 这样可以防止在XML记事本中打开文件。 有没有人遇到过这个? 这是代码。

I am writing a sub for in VB.net for a WP7 application that creates an XML file in isolated storage using Linq/XDocument.  The XML appears to be creating correctly however when I open the file there are about a hundred blank spaces being written after the last xml tag.  This is preventing the file from being opened in XML Notepad.  Has anyone encountered this?  Here is the code.


  Private Sub sbCreateSurvey()

        If IsolatedStorageFile.GetUserStoreForApplication.FileExists(SharedProperties.MasterFile) Then

             Using store = IsolatedStorageFile.GetUserStoreForApplication

              Dim sFile As String = "test.xml"

                Using stream As New IsolatedStorageFileStream(sFile, FileMode.Create, FileAccess.Write, store)

                    Dim xDoc As New XDocument(New XDeclaration("1.0", "utf-8", "yes"), _
                                              New XElement("questions")) 

                    xDoc.Save(stream)

                End Using

             End Using

        End If

 End Sub  

推荐答案

Hi Bugsy33,

Hi Bugsy33,

此论坛适用于wWP7之前的开发。你可能最好在这个论坛上提出问题http://forums.create.msdn.com/forums/

This forum is for pre wWP7 development. You probably better ask the question in this forum http://forums.create.msdn.com/forums/

 


这篇关于WP7独立存储文件流使用XDocument.Save时添加空格/空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆