0

Before we were running on Windows XP and we were using LiveLink, everything was working fine. We recently moved to Content Server and Windows 7.

There is a function from Opentext xml export guide that let you export XML from a URL. The vba code use to load this url and put it in MSXML2.DOMDocument60.

Dim xmldoc As MSXML2.DOMDocument60
Set xmldoc = New MSXML2.DOMDocument60
xmldoc.Load (xmlURL)

Since the migration this doesn't work anymore. I changed the URL to the new server and read the new guide. When I type the url in IE8, I get the xml, but it isn't properly formated...There is 2 spaces before the xml declaration that cause problem and the - and + to hide/expand are seen as characters too. If I copy/paste in notepad++ and remove the 2 extra spaces and replace all "- <" by " <", and then load this file in my Domdocument, everything works. Encoding is the right one UTF-8, I tried a few parameters that can be passed to the xmlexport function but nothing changed.

My plan is to export the xml into a temp text file from my URL and correct it so I can pass the right xml to my function that populates my DB. I searched for a way to do this but none worked so far. thank you for help.

trixrabbit
  • 259
  • 7
  • 22

2 Answers2

0

It's possible to use VBscript to read a text file into a variable, then re-write the variable into another text file, minus the first two characters.

Here's a page where something similar is discussed: Read and write into a file using VBScript

It might be something like:

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("c:\scripts\servers.txt", ForReading)

strText = objTextFile.ReadAll
objTextFile.Close

Set objTextFile = objFSO.CreateTextFile("c:\scripts\servers2.txt", True)
objTextFile.Write (right(strText, len(strText)-2))

I haven't tested this, but it's essentially what you want to do. I think.

Community
  • 1
  • 1
n8.
  • 1,732
  • 3
  • 16
  • 38
0

I use the function :

 Private Declare Function URLDownloadToFile Lib "urlmon" _
 Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
 ByVal szURL As String, ByVal szFileName As String, _
 ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

to save my web page into a doc.xml, then I load it in the DOMdoc

 xmldoc.Load (path_to_doc.xml)
trixrabbit
  • 259
  • 7
  • 22