none
pacakge reading problem RRS feed

  • Question

  •  

    hello everybody,

     

                            Iam reading the docProps/core.xml title and author node. my code snippet is

     

    Package pack = Package.Open(fName);

    Uri uri= new Uri("/docProps/core.xml", UriKind.Relative);

    PackagePart packPart = pack.GetPart(uri);

    pack.GetPart(uri);

    XmlDataDocument xdoc = new XmlDataDocument();

    xdoc.Load(packPart.GetStream(FileMode.Open));

    XmlNamespaceManager nsmgr = new XmlNamespaceManager(xdoc.NameTable);

    nsmgr.AddNamespace("cp", corePropertiesSchema);

    nsmgr.AddNamespace("dc", dcPropertiesSchema);

    XmlNode xn = null;

    xn = xdoc.SelectSingleNode("cp:coreProperties/dc:title", nsmgr);

    if (xn != null)

    tbTitle.Text = xn.InnerText;

    xn = xdoc.SelectSingleNode("cp:coreProperties/dc:creator", nsmgr);

    if (xn != null)

    tbAuthor.Text = xn.InnerText;

    pack.Close();

     

    I have no problem in reading the data from a normal word document. But i have a document in which i embedded a new .xml file in the docProps folder. Now i could read this new document docProps/core.xml. Could anyone knows what would be the problem. Actually the error is the package(docProps/core.xml) is not there, but when i extract and look at it, its there. what could be the problem or error ?..

     

    thank you.

    Dinesh,

    Friday, March 28, 2008 2:22 PM

All replies

  • Seems there are problems in your new file.
    I tried the code and it can run without problem.
     
    Wednesday, April 9, 2008 5:43 AM