Question

I have an XML file that I need to get as a string and put into an ASP file so it can be sent to the Volusion API. The Xml_to_Send variable is currently set up with the XML header and the XML file is all formatted correctly. The issue is that I need to get the values of the XML as the code it displays (with it's XML tags; not just the values of each XML tag). Here's what I have for the variable:

dim Xml_to_Send
Xml_to_Send = "<?xml version=""1.0"" encoding=""utf-8"" ?>"
Xml_to_Send = Xml_to_Send & "THIS IS WHERE THE XML STRING WOULD GO"

And then an example of my XML (which is in a separate file because it is being created dynamically by a third party) is:

<Volusion_API>
    <Orders>
        <ProductCode>Test</ProductCode>
    </Orders>
</Volusion_API>

And I need it to look like:

dim Xml_to_Send
Xml_to_Send = "<?xml version=""1.0"" encoding=""utf-8"" ?>"
Xml_to_Send = Xml_to_Send & "<Volusion_API><Orders><ProductCode>Test</ProductCode></Orders></Volusion_API>"

I've gotten as far as using load or loadXML in VBScript but can't seem to figure out how to get the appropriate values out of the loaded file. Any help would be greatly appreciated. Thanks!

Was it helpful?

Solution

Use the FileSystemObject's methods .OpenTextFile() and .ReadAll() to get the content of your .XML file and concatenate that to xml_to_send.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top