Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:09:39+00:00 2026-05-26T05:09:39+00:00

sub generateCategoryXML_helper() dim FSO, fileOut set FSO = CreateObject(Scripting.FileSystemObject) set fileOut = FSO.CreateTextFile(Server.MapPath(categoryTree.xml), True)

  • 0
sub generateCategoryXML_helper()

dim FSO, fileOut
set FSO = CreateObject("Scripting.FileSystemObject")
set fileOut = FSO.CreateTextFile(Server.MapPath("categoryTree.xml"), True)

fileOut.WriteLine("<?xml version=""1.0"" encoding=""UTF-8""?>")

set RS_categoryXML = callStoredProcedure("generateCategoryXML", null) 

while not RS_categoryXML.EOF

    fileOut.Write(RS_categoryXML(0))

    RS_categoryXML.MoveNext

wend

end sub

The fileOut.Write(RS_categoryXML(0)) throws an error: Microsoft VBScript runtime error: Invalid procedure call or argument

RS_categoryXML(0) contains an XML doc. RS_categoryXML(0) stored as a byte array. Why? It should be a long string that I can write to the file but for some reason it’s stored as a byte array and fails to output.

Thanks,

Tomas

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:09:39+00:00Added an answer on May 26, 2026 at 5:09 am

    RS_categoryXML(0) stored as a byte array. Why?

    You haven’t shown us anything relevant to that so its difficult to say. We have no idea what SQL is in the “generateCategoryXML” or even what database engine you are using (including its version).

    That said I’ll guess what you have as byte array containing the xml already encoded to UTF8. I’ll also guess that there is only ever one record in the recordset (else the XML you are attempting to create will be missing a root element).

    Another problem you have is you are attempting to use FSO to write a UTF8 encoded XML file but FSO can’t handle UTF8.

    My advice would be drop the use of FSO and switch to ADODB.Stream instead, that will allow you to write the bytes directly to the stream and save the file. I wouldn’t even bother with the xml declaration its only really useful when specifying an encoding different from UTF8.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public sub Main() Set objShell = CreateObject(WScript.Shell) strCommand = C:/Program Files/s/schedule.exe objShell.Run strCommand, vbHide,
Private Sub Command1_Click() Dim x As Integer For x = 1 To 100 List1.AddItem
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress Dim allowedChars
Private Sub Command1_Click() Dim dom As New DOMDocument Dim http As New XMLHTTP Dim
Sub something(tecan) On Error Resume Next Dim arr As New Collection, a Dim aFirstArray()
Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click Dim Inputter
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim p
sub numeric_p { local($data) = @_; if ($data =~ /^-?\d*\.?\d*(e\d|e-\d)?\d*$/) { $true; } else
Private Sub importClipboard_Click() Dim data As Collection data = getClipboardData() ...do something... End Sub
Public Sub cleanTables(ByVal prOKDel As Short) Dim sqlParams(1) As SqlParameter Dim sqlProcName As String

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.