Login | |
|
 |
RE: XML to CSV in VBScript - 9/8/2005 1:17:13 AM
|
|
 |
|
| |
ebgreen
Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
|
If you are going to be writing your own parser, I would highly recommend looking at Regular Expressions and Dictionaries. If I were writing a parser, I would use regular expressions to build a dictionary representation of the xml file. The dictionary could hold dictionaries to an arbitrary level of recursion that would only be limited by your machine's memory.
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/8/2005 7:25:06 PM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
Maybe you can first try if the script can create the XMLDOM object? With the following code you could test this: Option Explicit Dim objXML Set objXML = CreateObject("Microsoft.XMLDOM") If objXML Is Nothing Then WScript.Echo "Failed to create object" Else WScript.Echo "Successfully created the object" End If Set objXML = Nothing Note that if the script can't create the object, you won't get the message "Failed to create object", you will get an error in stead "ActiveX component can't create object: 'Microsoft.XMLDOM'" If you want to script to return the failed message, you'll have to put the script between the statements "On Error Resume Next" and "On Error Goto 0". HTH
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/8/2005 10:08:18 PM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
Congratulations
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/9/2005 12:28:27 AM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
First of all, arrays in VbScript are zero based. Which means that the first element of the array has index zero. If you define a array like this ch(3), you actually have four elements in this array (from index 0 till index 3) With the UBound() function, you can retrieve the upper bound of an array. One other small remark: it's better to use the ampersand (&) to concatenate strings and use the plus sign (+) to add arithmetic values. Maybe an example explains it better: Dim ch(3) ch(0) = "a" ch(1) = "b" ch(2) = "c" ch(3) = "d" For i = 0 To UBound(ch) dh = dh & ch(i) Next WScript.Echo dh
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/9/2005 12:45:01 AM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
Then you could set the "Step" in the For-Next loop to -1 (default it is 1) Examples often explain better: For i = UBound(ch) To 0 Step -1 dh = dh & ch(i) Next
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/9/2005 1:15:20 AM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
Well, in the pinned post (http://www.visualbasicscript.com/m_24727/tm.htm) there are some links to the WSH documentation and other very interesting pages about VbScript. I would suggest you look into these, especially for the basic things. And you can still post your problems and/or questions here of course!
|
|
| |
|
|
|
 |
RE: XML to CSV in VBScript - 9/11/2005 11:54:39 PM
|
|
 |
|
| |
Zifter
Posts: 318
Score: 0
Joined: 1/5/2005
From: Belgium
Status: offline
|
In the pinned post (where I link to in post number 33) you can find links to the VbScript documentation. And in another post of mine (number 5) I provided a link specifically about the XMLDOM object. Just re-read this topic. If you get an automatic list of properties and methods about an object, then that is because the editor you're using supports this. This has nothing to do with the language itself. There are editors which have code-completion and a kind of IntelliSense and much more to help you develop your scripts. UltraEdit or PrimalScript , just to name two. Check the net (or the google adds on this site)
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|