ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 13th, 2005, 06:24 PM
iychen iychen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 2 iychen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 sec
Reputation Power: 0
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>
:p

Reply With Quote
  #2  
Old June 13th, 2005, 06:48 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
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.

Reply With Quote
  #3  
Old June 14th, 2005, 09:38 AM
iychen iychen is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 2 iychen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > need serious help-error while parsing an xml document?????


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway