Relationship file selectnodes issue RRS feed

  • Question




    I try to selectnodes in the presentation.xml.rels file. When I use the Xml Parser of microsoft to handle my search, I got nothing.


    Here is my code :


    Const presentationmlNamespace As String = ""

    Const drawingNamespace As String = ""

    Const relationshipNamespace As String = ""

    Dim nsManager As XmlNamespaceManager = New XmlNamespaceManager(nt)

    nsManager.AddNamespace("p", presentationmlNamespace)

    nsManager.AddNamespace("a", drawingNamespace)

    nsManager.AddNamespace(String.Empty, relationshipNamespace)

    Dim XMLSlide As XmlDocument

    Dim uriPart As Uri = New Uri("/ppt/_rels/presentation.xml.rels", UriKind.Relative)

    Dim getPart As PackagePart = ppt.Package.GetPart(uriPart)


    Dim SldRel As XmlNode = XMLSlide.SelectSingleNode("//Relationships", nsManager)


    SldRel is empty, could someone helps me?
    Tuesday, October 2, 2007 4:26 PM

All replies

  • What is into XMLSlide.OuterXML?

    The namespaces presentationmlNamespace and drawingNamespace you are adding are present in the document?


    Monday, October 8, 2007 1:03 PM
  • XPath do not support default namesapce. You must speficy the namespace in the XPath.
    Try change the followng codes:
    nsManager.AddNamespace("r", relationshipNamespace)

    Dim SldRel As XmlNode = XMLSlide.SelectSingleNode("//r:Relationships", nsManager)

    Friday, October 12, 2007 2:50 AM