How do I read a embeded XML file

  • Thread starter Thread starter David
  • Start date Start date
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
 
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
 
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
 
Back
Top