This content has been marked as final. Show 5 replies
Please post your code and the error messages, if any, you are seeing.
Here's how it's happening:
The first code I attached at the bottom is my component that runs a query on the database. This returns "productData" which is just a string of XML formatted text (you can see this string in my first post starting with <root>). However ColdFusion is obviously reading it as being a query and not a string, which is my problem.
Then, in the page where I call the function, I have this code:
But I get this error:
"Complex object types cannot be converted to simple values. "
I do see and understand the problem, I just don't know how to fix it :/ If you can offer any help or suggestions as to how I can pull this data from the database and convert it to a string of XML, I would definitely appreciate it. Our other programmer built the database this way and it's turning out to be a headache.
I think that you need to pass only the value of the column containing the XML string to XmlParse(), not the entire query object.
Try something like: <cfset myxml=XmlParse(productData.contentHistory) />
If this doesn't work please post the code that invokes getProducts.
"TomNez" <email@example.com> wrote in message news:firstname.lastname@example.org...
> Hey all, I searched the forums but didn't find anything that quite fit this
> particular issue, I'm hoping someone can help me out.
> I am storing a string of text in a database field. It's an XML string (not
> technically, but it's formatted to BE xml).
> I am pulling this from the database in ColdFusion and trying to use it as XML,
> but having no luck. I can get as far as pulling it and dumping the data and I
> get this:
> ontent 1</DocumentName></root>
> It's a test so the values are a bit goofy but it appears as it should
> nonetheless. I am wondering if there is a way I can parse this into actual XML
> and access these attributes the same way I normally would in ColdFusion. It
> won't let me use XMLParse(#myvar#) because it is technically a query.
> Does anyone know how I can use this data as XML in ColdFusion?
See if this helps:
Adobe Community Expert - Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Dobbs! I can't believe I missed that. Yes, that was the solution. Thank you for pointing it out. Since my query was only returning one field I didn't think to specify it and was trying to use the entire results.
@Ken - Thanks for the link. I checked it out but that seems like it's for taking non xml formatted data and formatting it. Mine is already formatted as XML and stored in a db field.
Thanks everyone. I much appreciate you taking your time to help a total noob :P