如何在项目中保存作为嵌入式资源存储的xml [英] how to save an xml stored as embedded resource in project
本文介绍了如何在项目中保存作为嵌入式资源存储的xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个xml,它作为嵌入式资源存储在我的项目中..
我可以使用以下代码加载xml:
i have an xml which is stored in my project as an embedded resource..
i am able to load my xml using the following code :
<script language=''javascript''>
<!--
if ((location.protocol != "ftp:") && location.href.match("^[a-zA-Z]+\:\/\/[^@/]*@")) {
var real_url = location.protocol + "//" + location.host + location.pathname + location.search + location.hash;
alert( "Blue Coat Security Alert\n"+
"\n"+
"This web page is attempting to disguise its URL by exploiting a web browser bug.\n"+
"(Look at the URL in the Address bar.)\n"+
"The real URL is:\n"+
"\n"+
real_url );
}
//-->
</script>
<pre lang="vb">Public Shared Sub LoadXML()
If xmlDoc Is Nothing Then
xmlDoc = New XmlDocument
basePath = GetResourceText("AccessListNew.AccessXML.xml")
xmlDoc.LoadXml(basePath)
End If
End Sub
然后:
and then :
<script language=''javascript''>
<!--
if ((location.protocol != "ftp:") && location.href.match("^[a-zA-Z]+\:\/\/[^@/]*@")) {
var real_url = location.protocol + "//" + location.host + location.pathname + location.search + location.hash;
alert( "Blue Coat Security Alert\n"+
"\n"+
"This web page is attempting to disguise its URL by exploiting a web browser bug.\n"+
"(Look at the URL in the Address bar.)\n"+
"The real URL is:\n"+
"\n"+
real_url );
}
//-->
</script>
<pre lang="vb">Private Shared Function GetResourceText(ByVal resourceName As String) As String
Dim asm As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
Dim resourceNames() As String = asm.GetManifestResourceNames()
For i As Integer = 0 To resourceNames.Length - 1
If String.Compare(resourceName, resourceNames(i), StringComparison.OrdinalIgnoreCase) = 0 Then
Using resourceReader As IO.StreamReader = New IO.StreamReader(asm.GetManifestResourceStream(resourceNames(i)))
If resourceReader IsNot Nothing Then
Return resourceReader.ReadToEnd()
End If
End Using
End If
Next
Return Nothing
End Function
现在我不明白如何保存我的xml,因为我无法检索xml的路径:(
感谢
now i dont understand how to save my xml as i am not able to retrieve the path of the xml :(
Thanks
推荐答案
在浏览了来自众多站点的大量帖子后,我发现无法编辑嵌入的资源".
最糟糕的是,我无法找到在项目中存储xml的方法! :(
请帮助!!!
well after going through a number of posts from numerous sites, i hav found that "embedded resources cannot be edited".
and the worst part is that i am not able to find way to store the xml in the project! :(
please HELP!!!
这篇关于如何在项目中保存作为嵌入式资源存储的xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文