I do not see why you are making XML object to store it in mongo. If you want to store an XML string use <cfsavecontent variable="temp"> rather than cfxml.
But personally I'd rather represent my data as json as kinda defeats the object puttying XML in. A On Friday, 7 September 2012, Ben <[email protected]> wrote: > Hey All, > I have an issue saving XML into Mongo. Here is a quick example of what I am trying to do: > <cfxml variable="Temp"> > <root> > <child Id="1"> > <Element1 id="1">123</Element1> > <Contact> > <ContactName>George Washington</ContactName> > </Contact> > </child> > <child Id="2"> > <Element1 id="1">456</Element1> > </child> > </root> > </cfxml> > <cfset MongoCollectionsave('mongodb', 'temp', temp)> > When I run this, this is the record that I receive in Mongo: > { "_id" : { "$oid" : "504a1bcec70bbc1e8776b5cc"} , "root" : { "child" : [ { "#text" : [ { } , { } , { }] , "Element1" : { "#text" : { }} , "Contact" : { "ContactName" : { "#text" : { }} , "#text" : [ { } , { }]}} , { "Element1" : { "#text" : { }} , "#text" : [ { } , { }]}] , "#text" : [ { } , { } , { }]}} > > As you can see, the element names are there, but none of the data. Is there something else that I should be doing here to convert it before passing it to MongoCollectionSave or is MongoCollectionSave supposed to handle all of this? > Thanks! > Ben > > -- > online documentation: http://openbd.org/manual/ > http://groups.google.com/group/openbd?hl=en > -- Alex Skinner Managing Director Pixl8 Interactive Tel: +448452600726 Email: [email protected] Web: pixl8.co.uk -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en
