xml-newbie: How to access xml file as embedded resource?

xml-newbie: How to access xml file as embedded resource?

Post by Jan Apun » Wed, 13 Feb 2002 03:38:11



I keep all version info in some xml file, so I need
to have it as embedded resource.

How to access it from code?

Thanks!
Japung

 
 
 

1. Help needed with embedded XML resource file

Hi,

I have a an XML file embedded into my application assembly -
the XML file 'Build Action' is set to 'Embedded Resource'.

What I'd like to know is the easiest way to get this XML file into an
XmlDocument object within a class in the same assembly.

So far, I can get hold of the XML file using -

System.IO.Stream stream =
(Assembly.GetExecutingAssembly().GetManifestResourceStream("MyAssembly.MyFil
e.xml"));

Then read the file into a Byte array -

Byte[] data = new Byte[100000];
stream.Read(data, 0, 100000);

My question is really two fold -

1)  Is there an easier or better way to read the embedded XML file?
2)  How do I get the file into an XmlDocument object?

TIA,

JAS.

2. Problem deserializing a structure containing an enum

3. Embedding an XML file as a resource

4. can SourceSafe do this?

5. Write to Xml File Embedded Resource at Runtime

6. MDT 2.0 STD PARTS

7. XML Newbie question, getting a value from an XML string

8. 123v5 - entering line returns in an edit field in a dialog box

9. Adding XML from one file into another XML file

10. XML Newbie question, getting a value from an XML string

11. BUG? Wrong XML resource namespace in common file

12. .ResX XML based resource files

13. How to use "Embedded Resource" -files (*.aspx.resx -files)?