Modify output from .xmlmap

gerfoy3

New Member
Joined
Apr 28, 2014
Messages
2
Hi,

We have a macro that runs to create outputs into an xml file.
These files are then used by another application but before we can used them in that application we need to manually modify the .xml file(s)
The lines that need to change are the two at the top of the outputted .xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <InputFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">



Is there anyway to modify the xmlmap to modify these lines?
Line 1 should be removed
Line 2 should just be <InputFile>

I suspect its not possible the only thing I can think of is editing the file(s) with vbs or perl.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
just used vbs to modify it if anyone is looking for a solution.
Readline -- Add to Array
Modify the Array
WriteLine
Close the file..

Public Function Edit_Xml(strPath)
'GF Added April 2014
'Changes the first two tags on the xml file so manual intervention is no longer needed


'Hold the File info in the Array to Edit it
Dim ArrayContents()
Dim iCounter
Dim strLine


iCounter = 0


Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFile = objFS.OpenTextFile(strPath)


Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine

If iCounter > 0 Then
If iCounter = 1 Then ' Change the strLine
strLine = "<InputFile>"
End If

ReDim Preserve ArrayContents(iCounter - 1)
ArrayContents(iCounter - 1) = strLine
End If
iCounter = iCounter + 1
Loop

objFile.Close

'Write the New Entries
Set objFile = objFS.OpenTextFile(strPath, 2)

For i = 0 To UBound(ArrayContents)
objFile.WriteLine ArrayContents(i)
Next i

objFile.Close

Set objFS = Nothing
Set objFile = Nothing
End Function
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,987
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top