Results 1 to 5 of 5

Thread: xml

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    116

    Question xml

    I have the following sample xml doc and I need to read this into VB6. I am using Microsoft XML version 2.0 reference and have declared the following variables.

    Dim xmlDoc As New MSXML.DOMDocument
    Dim root As MSXML.IXMLDOMElement
    Dim oNodeList, iNodeList As MSXML.IXMLDOMNodeList
    Dim Item As MSXML.IXMLDOMNode

    Can someone help me - show me how to read the xml tag values into string type variables.

    I keep getting the error msg 'Object variable or With Block variable Not Set'.

    Anyone?

    Thanks


    Code:
    <?xml version="1.0" encoding="utf-8" ?>
    <Begin>
    	
    	<Header fileFormat="2.0" generated="2004-03-21 15:21:06" source="Back Office">
    		<Sender reference="me" name="Logistics" url="ftp://myftp.me.co.uk/In" />
    		<Recipient reference="0140" name="AM Widgets" url="ftp://myftp.me.co.uk/Out/0110" />
    	</Header>
    	
    	<Addresses original="" reference="1022" name="Me Me" postalAddress="831 Tone Crescent"
    		postalCode="T65 Woo" telephoneNumber="01111 111111" faxNumber="" mobileNumber="01111 1111111"
    		primaryDropPoint="Black cat" secondaryDropPoint="Electric cupboard on front of house"
    		specialInstructions="Beware of vicious cat!" routesReference="A1" active="True" lastChange="2004-03-21 18:22:00" />
    	<Addresses original="1024" reference="1024" name="Anthony T" postalAddress="The Inn"
    		postalCode="LQ5 1JU" telephoneNumber="01999 4111217" faxNumber="" mobileNumber="" primaryDropPoint="Bar"
    		secondaryDropPoint="None" specialInstructions="Do not deliver before 08:00" routesReference="A2"
    		active="True" lastChange="2004-03-21 18:25:16" />
    	<Addresses original="1022" reference="1022" name="Robin R" postalAddress="832 The Crescent"
    		postalCode="R65 9HE" telephoneNumber="01000 1111111" faxNumber="" mobileNumber="01111 1111111"
    		primaryDropPoint="Black BK52DPU" secondaryDropPoint="Electric cupboard on front of house"
    		specialInstructions="Beware of vicious cat!" routesReference="A2" active="True" lastChange="2004-03-21 18:28:15" />
    
    </Begin>

  2. #2
    Fanatic Member ahara's Avatar
    Join Date
    Nov 2003
    Location
    Toronto
    Posts
    531
    can you show the VB code that is giving you the object error?
    "Knowledge is gained when different people look at the same information in different ways"

    - Louis Pasteur

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    116

    Question .............

    The following lines of code call another method and stores the entire xml data into a variable - this works fine.
    Code:
        xmlData = text_read(fileNames)
        glbHoldXML = xmlData
        
        xmlDoc.async = False
        xmlDoc.loadXML (xmlData)
    This is where is falls:
    (the following code was an example i was given)

    Code:
       Set root = xmlDoc.documentElement  ' this line is ok
       Set oNodeList = root.childNodes ' ** Error
    thanks again

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    116

    Thumbs up .....

    Ive got now...
    thanks anyway

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width