troubleshooting Question

CFMX: Parse an xml, then write it back to file. Bug or error?

Avatar of johndcampbell
johndcampbell asked on
Web Servers
8 Comments1 Solution290 ViewsLast Modified:
I'm trying to read in an xml file, then write it back out again, but I'm getting a Java error:

Error casting an object of type coldfusion.xml.XmlNodeList to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed. coldfusion.xml.XmlNodeList  



This code:

<cfset fileName="/export/local/www.projects/html/students/MScIT/campbelj/forum/test/test.xml">
<cfoutput><p>#fileName#</p></cfoutput>

<cffile
     action="read"
     file=#fileName#
     variable="myFile"
>

<cfset mydoc = XmlParse(myFile)>

<cffile action="Write"
     file="/export/local/www.projects/html/students/MScIT/campbelj/forum/test/test.xml"
     output="#mydoc#"
>

-------------------------------------
on this xml file:

<?xml version="1.0"?>
<nodes name="what">
     <node name="who"></node>
     <node name="where"></node>
</nodes>

(The only white spaces are those added by a previous cffile write.)

-------------------------------------
And I'm getting this error:

The Error Occurred in /export/local/www.proj/html/students/MScIT/campbelj/forum/test/xml2.cfm: line 16
 
14 :      file="/export/local/www.projects/html/students/MScIT/campbelj/forum/test/test.xml"
15 :      output="#mydoc#"
16 : >

-------------------------------------



Any ideas?
ASKER CERTIFIED SOLUTION
GhostMod

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros