|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
need serious help-error while parsing an xml document?????
I want to generate a word document through xml. I tried to put the BODY section into a cfc and let a function return the xml object, so that I can add logics and loops into the xml object. The problem is that when I load the page, it returns an error saying something like "The prefix "w" for element "w:body" is not bound." Debugging shows that the error occured while parsing xml document. Can anyone guess what the reason might be? I need serious help, so any input would be greatly appreciated.
Below is my test code: cfm code: Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?mso-application progid="Word.Document"?> <W:WORDDOCUMENT xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" w:macrospresent="no" w:embeddedobjpresent="no" w:ocxpresent="no" xml:space="preserve"> <O:DOCUMENTPROPERTIES> <O:TITLE> This is a test </O:TITLE> <O:AUTHOR> GX280 </O:AUTHOR> <O:LASTAUTHOR> GX280 </O:LASTAUTHOR> <O:REVISION> 1 </O:REVISION> <O:TOTALTIME> 0 </O:TOTALTIME> <O:CREATED> 2005-06-13T22:58:00Z </O:CREATED> <O:LASTSAVED> 2005-06-13T22:58:00Z </O:LASTSAVED> <O:PAGES> 1 </O:PAGES> <O:WORDS> 2 </O:WORDS> <O:CHARACTERS> 17 </O:CHARACTERS> <O:COMPANY> Kelley School of Business </O:COMPANY> <O:LINES> 1 </O:LINES> <O:PARAGRAPHS> 1 </O:PARAGRAPHS> <O:CHARACTERSWITHSPACES> 18 </O:CHARACTERSWITHSPACES> <O:VERSION> 11.5604 </O:VERSION> </O:DOCUMENTPROPERTIES> <W:FONTS> <W:DEFAULTFONTS w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman"/> </W:FONTS> <W:STYLES> <W:VERSIONOFBUILTINSTYLENAMES w:val="4"/> <W:LATENTSTYLES w:deflockedstate="off" w:latentstylecount="156"/> <W:STYLE w:type="paragraph" w:default="on" w:styleid="Normal"> <W:NAME w:val="Normal"/> <W:RPR> <WX:FONT wx:val="Times New Roman"/> <W:SZ w:val="24"/> <W:SZ-CS w:val="24"/> <W:LANG w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA"/> </W:RPR> </W:STYLE> <W:STYLE w:type="character" w:default="on" w:styleid="DefaultParagraphFont"> <W:NAME w:val="Default Paragraph Font"/> <W:SEMIHIDDEN/> </W:STYLE> <W:STYLE w:type="table" w:default="on" w:styleid="TableNormal"> <W:NAME w:val="Normal Table"/> <WX:UINAME wx:val="Table Normal"/> <W:SEMIHIDDEN/> <W:RPR> <WX:FONT wx:val="Times New Roman"/> </W:RPR> <W:TBLPR> <W:TBLIND w:w="0" w:type="dxa"/> <W:TBLCELLMAR> <W:TOP w:w="0" w:type="dxa"/> <W:LEFT w:w="108" w:type="dxa"/> <W:BOTTOM w:w="0" w:type="dxa"/> <W:RIGHT w:w="108" w:type="dxa"/> </W:TBLCELLMAR> </W:TBLPR> </W:STYLE> <W:STYLE w:type="list" w:default="on" w:styleid="NoList"> <W:NAME w:val="No List"/> <W:SEMIHIDDEN/> </W:STYLE> </W:STYLES> <W:DOCPR> <W:VIEW w:val="print"/> <W:ZOOM w:percent="100"/> <W:DONOTEMBEDSYSTEMFONTS/> <W:ATTACHEDTEMPLATE w:val=""/> <W:DEFAULTTABSTOP w:val="720"/> <W:PUNCTUATIONKERNING/> <W:CHARACTERSPACINGCONTROL w:val="DontCompress"/> <W:OPTIMIZEFORBROWSER/> <W:VALIDATEAGAINSTSCHEMA/> <W:SAVEINVALIDXML w:val="off"/> <W:IGNOREMIXEDCONTENT w:val="off"/> <W:ALWAYSSHOWPLACEHOLDERTEXT w:val="off"/> <W:COMPAT> <W:BREAKWRAPPEDTABLES/> <W:SNAPTOGRIDINCELL/> <W:WRAPTEXTWITHPUNCT/> <W:USEASIANBREAKRULES/> <W:DONTGROWAUTOFIT/> </W:COMPAT> </W:DOCPR> <CFOBJECT name="xmlobject" component="xmlCFC"> <CFSET myxml = xmlobject.xmlbody()> <CFOUTPUT> #myxml# </CFOUTPUT> </W:WORDDOCUMENT> <cfcontent type="application/msword" reset="No"> <cfheader name="Content-Disposition" value="attachment; filename=""AdmissionLetter.doc"""> <cfsetting showDebugOutput="false"> cfc code: Code:
<cfcomponent> <cffunction name="xmlbody" access="public" returntype="xml"> <cfxml variable="xmlobject"> <W:BODY> <WX:SECT> <W:P> <W:PPR> <W:RPR> <W:SZ w:val="20"/> <W:SZ-CS w:val="20"/> </W:RPR> </W:PPR> <W:R> <W:RPR> <W:SZ w:val="20"/> <W:SZ-CS w:val="20"/> </W:RPR> <W:T> This is a test. </W:T> </W:R> </W:P> <W:P> <W:PPR> <W:RPR> <W:SZ w:val="20"/> <W:SZ-CS w:val="20"/> </W:RPR> </W:PPR> <W:R> <W:RPR> <W:SZ w:val="20"/> <W:SZ-CS w:val="20"/> </W:RPR> <W:BR w:type="page"/> <W:T> </W:T> </W:R> </W:P> <W:SECTPR> <W:PGSZ w:w="12240" w:h="15840"/> <W:PGMAR w:top="1296" w:right="1152" w:bottom="720" w:left="2736" w:header="720" w:footer="720" w:gutter="0"/> <W:COLS w:space="720"/> <W:DOCGRID w:line-pitch="360"/> </W:SECTPR> </WX:SECT> </W:BODY> </cfxml> <cfreturn xmlobject> </cffunction> </cfcomponent> |
|
#2
|
|||
|
|||
|
My first thought is that the creation of the XML document object is failing because it doesn't recognize the namespace "W". I haven't tried creating XML objects that have namespaces in them so I have no idea how the tag reacts to them.
I would start with the simplest example you can create, get it working, and then add onto it from there until you determine where the problem is.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums Last edited by kiteless : June 13th, 2005 at 06:51 PM. |
|
#3
|
|||
|
|||
|
why is that?
The code looks ugly I know. It may be the code sweeper that caused error.
I have exactly the same file under server folder and local folder. It would work on server but not local. The word doc I used is the simplest I can ever make (just one sentense), it is saved as xml and pasted to coldfusion file. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > need serious help-error while parsing an xml document????? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|