How do I read a embeded XML file

D

David

Hi, all,
I have the following code to read from a standalone XML
file.

Dim reader As XmlTextReader
reader = New XmlTextReader(FileName)

Right now I would like to embed the file in the assembly.
I know the way to load image file from assembly by using
the following code:

LoadResourceImage = New Bitmap
(System.Reflection.Assembly.GetExecutingAssembly.GetManifes
tResourceStream(imageName))

But how do I read an XML file from assembly? Thanks a lot
for your help.

Thanks,

David
 
P

Peter Foot [MVP]

Since one of the XmlTextReader constructors takes a stream you should able
to do the following:-

Dim reader As XmlTextReader
reader = New
XmlTextReader(System.Reflection.Assembly.GetExecutingAssembly.GetManifestRes
ourceStream(xmlname))

Where xmlname is the full name including namespace of the embedded xml file.

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
 
D

David

Peter,
Thanks a lot. It works!

David

Peter Foot said:
Since one of the XmlTextReader constructors takes a stream you should able
to do the following:-

Dim reader As XmlTextReader
reader = New
XmlTextReader(System.Reflection.Assembly.GetExecutingAssembly.GetManifestRes
ourceStream(xmlname))

Where xmlname is the full name including namespace of the embedded xml file.

Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top