|
So I
had the same problem about 6 months ago,
for xml explicit did not return clean xml code
had a
job number and line breaks and record count at the end
so I
made a bat file called from cfexecute to run isqlw
command window to do the work
then
cleaned up the mess with some find and replace
<cfset dir_file="path to /g_parts_1010.xml"> <!--- <CFIF #FileExists(dir_file)#> <cffile action="" file="#dir_file#"> </cfif> <cfexecute name="C:\Program
Files\Microsoft SQL Server\80\Tools\binn\isqlw.exe" arguments="-S server -d database -E -i path to sql/g_parts_1010_xml.sql -o path to output /g_parts_1010.xml"
timeout=30>
</cfexecute> use
timeout to make sure you give the sql enough time to create the file.a flaw in
cfexecute will run till timeout even if job is done sooner.
this
is the contents of g_parts_1010_xml.sql
Select
* From Parts_1010 Parts Order by Make,Model,sYear,Part For XML raw end
content
then
clean it up
<cffile action=""
file="#dir_file#" Variable="XMLfile">
<cfset
x_end=#findNoCase("(",XMLFile,len(XMLFile)-100)#>
<cfset
x_start=#findNoCase("<",XMLFile)#>
<cfset
xmlTrim=left(XMLFILE,x_end-2)>
<cfset
xmlTrim=Right(XMLtrim,Len(XMLTrim)-(x_start-1))>
<cfset XMLtrim =
#replace(XMLTrim,"#chr(10)#","","ALL")#>
<cfset XMLtrim = #replace(XMLTrim,"#chr(13)#","","ALL")#> this add the correct
xml framing tag and title
<cfset Models_xml="<?xml version='1.0'?><Parts_1010>"&xmlTrim&"</Parts_1010>" > <cffile action="" file="output cleaned file to / g_parts_1010.xml"
output="#Models_xml#">
Hopes this helps
Sincerely
Greg
Maxwell
|
Title: Message
- [cf-xml] CFMX & SQL Server & XML, i'm stuck peter.dehaan
- Re: [cf-xml] CFMX & SQL Server & XML, i'm st... Greg Maxwell
- Re: [cf-xml] CFMX & SQL Server & XML, i'... peter.dehaan
- RE: [cf-xml] CFMX & SQL Server & XML, i'm st... Askew, Jason
- RE: [cf-xml] CFMX & SQL Server & XML, i'... Matthew Westcott
- Re: [cf-xml] CFMX & SQL Server & XML... peter.dehaan
- Re: [cf-xml] CFMX & SQL Server & XML, i'... peter.dehaan
- RE: [cf-xml] CFMX & SQL Server & XML, i'm st... Askew, Jason
- RE: [cf-xml] CFMX & SQL Server & XML, i'm st... Askew, Jason
