I examined your code and noticed this line from your GetInventoryInfo
():

string filename = "Products.xml";


And from the implementation of your GetXmlDocFromDefaultPackage(), you
re-introduced the Products.xml file again like so:


XmlReader reader = XmlReader.Create("Products.xml");


Try changing the argument into this:


XmlReader reader = XmlReader.Create(filename);



See if that helps.



Benj
















On Oct 11, 2:50 am, S <[email protected]> wrote:
> public class DataUtil
>         {
>             public static ProductInfo GetInventoryInfo(string sku)
>             {
>                 string filename = "Products.xml";
>                 XElement e = PackageUtil.GetXmlDocFromDefaultPackage
> (filename); // This is the line I get the error.
>
>             }
>         }
>
> namespace SLUtil
> {
>     public class PackageUtil
>     {
>         public static XElement GetXmlDocFromDefaultPackage(string
> filename)
>         {
>             XmlReaderSettings settings = new XmlReaderSettings();
>             settings.XmlResolver = new XmlXapResolver();
>             XmlReader reader = XmlReader.Create("Products.xml");
>             XElement element = XElement.Load(reader);
>             return element;
>         }
>
>     }
>
> }
>
> The namespace above is at the top of the file and I am trying to use
> the function but I get this error. Anyone know how to resolve this ?
>
> Thanks,
>
> All help appreciated

Reply via email to