[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

MSXML2.DOMDocument50 does not work

Euvin

11/20/2011 6:11:00 AM

I am reading Access 2003 programming by example with VBA, XML, and ASP
I just trying to running this code, but it is not doing anything. I am
not getting errors. There seems nothing wrong with the code, but I
seem to be missing something.

thanks

Option Compare Database
Option Explicit

Sub ReadXMLDoc()
Dim xmldoc As MSXML2.DOMDocument50
Set xmldoc = New MSXML2.DOMDocument50

xmldoc.async = False
If xmldoc.Load("C:\Users\Euvin\Documents\Example.xml") Then
Debug.Print xmldoc.XML
Debug.Print xmldoc.Text
End If
End Sub
4 Answers

ralph

11/20/2011 6:40:00 AM

0

On Sat, 19 Nov 2011 22:11:29 -0800 (PST), Euvin <juan.euvin@gmail.com>
wrote:

>I am reading Access 2003 programming by example with VBA, XML, and ASP
>I just trying to running this code, but it is not doing anything. I am
>not getting errors. There seems nothing wrong with the code, but I
>seem to be missing something.
>
>thanks
>
>Option Compare Database
>Option Explicit
>
>Sub ReadXMLDoc()
>Dim xmldoc As MSXML2.DOMDocument50
>Set xmldoc = New MSXML2.DOMDocument50
>
>xmldoc.async = False
>If xmldoc.Load("C:\Users\Euvin\Documents\Example.xml") Then
>Debug.Print xmldoc.XML
>Debug.Print xmldoc.Text
>End If
>End Sub


Check the value returned by the Load command.

http://msdn.microsoft.com/en-us/library/aa4...
Navigate down to the section titled "Dealing with Failure".

-ralph

Euvin

11/20/2011 8:14:00 AM

0

On Nov 20, 1:39 am, ralph <nt_consultin...@yahoo.net> wrote:
> On Sat, 19 Nov 2011 22:11:29 -0800 (PST), Euvin <juan.eu...@gmail.com>
> wrote:
>
>
>
>
>
> >I am reading Access 2003 programming by example with VBA, XML, and ASP
> >I just trying to running this code, but it is not doing anything. I am
> >not getting errors. There seems nothing wrong with the code, but I
> >seem to be missing something.
>
> >thanks
>
> >Option Compare Database
> >Option Explicit
>
> >Sub ReadXMLDoc()
> >Dim xmldoc As MSXML2.DOMDocument50
> >Set xmldoc = New MSXML2.DOMDocument50
>
> >xmldoc.async = False
> >If xmldoc.Load("C:\Users\Euvin\Documents\Example.xml") Then
> >Debug.Print xmldoc.XML
> >Debug.Print xmldoc.Text
> >End If
> >End Sub
>
> Check the value returned by the Load command.
>
> http://msdn.microsoft.com/en-us/library/aa4...
> Navigate down to the section titled "Dealing with Failure".
>
> -ralph- Hide quoted text -
>
> - Show quoted text -

Ralph,

I follow your advice, no change thus far. The code below is suppose to
create an xml and text file, but nothing has occurred when i run it.

Sub ReadXMLDoc()
Dim xDoc As MSXML2.DOMDocument50
Set xDoc = New MSXML2.DOMDocument50



xDoc.validateOnParse = False
If xDoc.Load("C:\Users\Euvin\Documents\shippers.xml") Then
MsgBox ("success")

Debug.Print xDoc.XML
Debug.Print xDoc.Text

' The document loaded successfully.
' Now do something intersting.
Else
' The document failed to load.
' The document failed to load.
Dim strErrText As String
Dim xPE As MSXML2.IXMLDOMParseError
' Obtain the ParseError object
Set xPE = xDoc.parseError
With xPE
strErrText = "Your XML Document failed to load" & _
"due the following error." & vbCrLf & _
"Error #: " & .errorCode & ": " & xPE.reason & _
"Line #: " & .Line & vbCrLf & _
"Line Position: " & .linepos & vbCrLf & _
"Position In File: " & .filepos & vbCrLf & _
"Source Text: " & .srcText & vbCrLf & _
"Document URL: " & .url
End With

MsgBox strErrText, vbExclamation
End If

End Sub

Jason Keats

11/20/2011 8:42:00 AM

0

Euvin wrote:
> I am reading Access 2003 programming by example with VBA, XML, and ASP
> I just trying to running this code, but it is not doing anything. I am
> not getting errors. There seems nothing wrong with the code, but I
> seem to be missing something.
>
> thanks
>
> Option Compare Database
> Option Explicit
>
> Sub ReadXMLDoc()
> Dim xmldoc As MSXML2.DOMDocument50
> Set xmldoc = New MSXML2.DOMDocument50
>
> xmldoc.async = False
> If xmldoc.Load("C:\Users\Euvin\Documents\Example.xml") Then
> Debug.Print xmldoc.XML
> Debug.Print xmldoc.Text
> End If
> End Sub

If your debug statements display nothing, then the load failed.

That can happen if the associated DTD file is missing - check for a
DOCTYPE in your XML file.

If you don't want to use a DTD, then delete that line, then try again.

You should (probably) also be using MSXML 3.0 or 6.0, not 5.0.

Euvin

11/20/2011 6:51:00 PM

0

On Nov 20, 3:41 am, Jason Keats <jke...@melbpcDeleteThis.org.au>
wrote:
> Euvin wrote:
> > I am reading Access 2003 programming by example with VBA, XML, and ASP
> > I just trying to running this code, but it is not doing anything. I am
> > not getting errors. There seems nothing wrong with the code, but I
> > seem to be missing something.
>
> > thanks
>
> > Option Compare Database
> > Option Explicit
>
> > Sub ReadXMLDoc()
> > Dim xmldoc As MSXML2.DOMDocument50
> > Set xmldoc = New MSXML2.DOMDocument50
>
> > xmldoc.async = False
> > If xmldoc.Load("C:\Users\Euvin\Documents\Example.xml") Then
> > Debug.Print xmldoc.XML
> > Debug.Print xmldoc.Text
> > End If
> > End Sub
>
> If your debug statements display nothing, then the load failed.
>
> That can happen if the associated DTD file is missing - check for a
> DOCTYPE in your XML file.
>
> If you don't want to use a DTD, then delete that line, then try again.
>
> You should (probably) also be using MSXML 3.0 or 6.0, not 5.0.- Hide quoted text -
>
> - Show quoted text -

I think the issue is object browser. When I select DOMDocument40 under
Library it states: "no item found"
I have tried double clicking, right clicking, and nothing has
occured.
: