hi,
I have created nice factory/product classes to parse a big xml file and
create a custom obj. i plan to instantiate the opening of the xml file
in the factory and have the actual parse code in the product classes.
So several "products" are going to use the different sections of the
XML file at different stages of execute. What would be the nicest way
to ensure that the XmlReaderClass is only opened once and whats the
best way to pass it around?
I have came up with a static variable solution but is there a nicer
way?
thx...here's some code:
class LoadXML
{
static XmlTextReader reader;
public LoadXML()
{
}
public static void OpenXMLfile()
{
if (reader.ReadState == ReadState.Closed)
{
reader = new
XmlTextReader(@"D:\philip\samples\xml\FinXML_US_MS FT.xml");
}
}
}