hog Posted October 14, 2003 Posted October 14, 2003 could anyone explain why based on the following I get both elements returned when I only want to return the path element?? <?xml version="1.0" encoding="utf-8" ?> <!ELEMENT config (path, sysadmin)> <!ELEMENT path (#PCDATA)> <!ELEMENT sysadmin (#PCDATA)> <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE Config PUBLIC "SYSTEM" "xConfig-DTD.xml"> <Config> <path>C:\Documents and Settings\paul\My Documents\project.mdb</path> <sysadmin>d.p.hooper</sysadmin> </Config> Try Dim strDocument As String = Environment.GetFolderPath(Environment.SpecialFolder.System) & "\xConfig.xml" Dim xPathDocument As XPathDocument = New XPathDocument(strDocument) Dim xPathNav As XPathNavigator = xPathDocument.CreateNavigator xPathNav.MoveToRoot() Dim xPathNodeIterate As XPathNodeIterator = xPathNav.Select("descendant::config/path") xPathNodeIterate.MoveNext() strPath = xPathNodeIterate.Current.Value Catch objException As Exception ShowError("Location: Class frmMain" & ControlChars.CrLf & ControlChars.CrLf & _ "Procedure: SetUserPref" & ControlChars.CrLf & ControlChars.CrLf & "Error Text: " & _ objException.Message) Return False End Try Quote My website
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.