I have a problem with the below code. It gives error Public member 'resolveExternal' on type 'DOMDocumentClass' not found. at the palce i mark in green. Please help me to solve this.....

Public Sub ReadIndXML(ByVal LoopID As Integer)

        Dim strXMLPath As String '= ""
        Dim xmlRoot As MSXML.IXMLDOMElement
        Dim objDOMXML As New MSXML.DOMDocument
        Dim intNodesLength As Short
        Dim i As Integer = 0
        'Dim strOutput As String = ""

        strXMLPath = CurDir() & "\Config\MainConfig.xml"

        objDOMXML.resolveExternal = True
        objDOMXML.validateOnParse = True
        objDOMXML.async = False
        Call objDOMXML.load(strXMLPath)

        xmlRoot = objDOMXML.documentElement
        If xmlRoot.baseName = "Configuration" Then
            If xmlRoot.childNodes.item(LoopID).hasChildNodes = True Then
                intNodesLength = xmlRoot.childNodes.item(LoopID).childNodes.length
                xmlRoot = xmlRoot.childNodes.item(LoopID).firstChild
                For i = 0 To intNodesLength - 1
                    If xmlRoot.attributes.item(0).text = "Assets" Then
                        XmlAssetsPath = xmlRoot.text
                    ElseIf xmlRoot.attributes.item(0).text = "PrimaryLanguage" Then
                        XmlPrimaryLanguage = xmlRoot.text
                    End If

                    xmlRoot = xmlRoot.nextSibling
                Next i
            End If
        End If

    End Sub

Don't use resolveExternal when xml document is constructed without exernal/internal DTD. Please post XML document here.


this is contents of my xml....Please help.TQ

<Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Key Name="General">
    <Value Name="Assets">C:\Program Files\abc\Assets</Value>
    <Value Name="config">C:\Program Files\abc\config</Value>
    <Value Name="PrimaryLanguage">English</Value>

Sorry! but the same code is running perfectly. (MSXML 2.0, MSXML2.6, 3.0 and other com lib). Try the .net framework System.XML API instead of COM.


do you have the sample's or else can you modify on my given source code...TQ

Imports System.Xml.Linq
Imports System.Xml

Public Class Sample
    Private Sub ReadData()
        Dim strXMLPath As String = "c:\path\config.xml"
        Dim doc As XDocument = XDocument.Load(strXMLPath)
        Dim path, lang As String
        For Each var In doc.Descendants("Value")
            If var.HasAttributes Then
                Select Case var.Attribute("Name").Value
                    Case "Assets"
                        path = var.Value
                    Case "PrimaryLanguage"
                        lang = var.Value
                End Select
            End If
    End Sub
End Class
This question has already been answered. Start a new discussion instead.