Title: Message
Hi Taco,
 
an example from something of mine, adding a new xml element to an existing xml doc
 
 
<cffile action="" file="#sFilename#" variable="sXML">
 
<cfscript>
XDocument     = XmlParse(sXML);
  
ndDocuments    = XDocument.documents;
 
ndDoc     = XmlElemNew(XDocument,"document");
stAttributes    = ndDoc.XmlAttributes;
stAttributes.bactive = 1;
stAttributes.title   = form.title;
stAttributes.filename  = stFileUpload.ClientFile;
stAttributes.size   = stFileUpload.FileSize;
stAttributes.mimetype = stFileUpload.ContentType & "/" & stFileUpload.ContentSubType;
stAttributes.user  = getAuthUser();
 
arrayAppend(ndDocuments.XmlChildren, ndDoc);
 
</cfscript>
 
<cfset sXML = ToString(XDocument)>
<cffile action="" file="#sFilename#" output="#sXML#" addnewline="No">
 
 
------ xml -------
 
<?xml version="1.0" ?>
<documents>
 <document title="Servers" filename="erusso-GAO-Servers-v02.doc" bActive="0"/>
 <document title="Layout" filename="erusso-UnitySiteLayout-v01.doc" bActive="1"/>
 <document title="CVS Setup" filename="cvs-instructions-v21.pdf" bActive="1"/>
</documents>
 
"Taco Fleur" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]...
When it comes to XML and CF I am still a bit wet behind the ears, and I was wondering if it is possible to add a complete xml structure of elements to an existing xml structure?
 
Example;
 
<root1>
<test><test2></test2></test>
</root1>
 
<root2>
<test><test2 attribute="something"></test2></test>
</root2>
 
And then something like <cfset structInsert(root1.test, "newElement", root2.test)>
and end up with something like
 
 
<root1>
<test>
<newElement><test><test2 attribute="something"></></test2></test></newElement>
<test2></test2></test>
</root1>
 
Dreaming or possible?
 
Taco Fleur

Tell me and I will forget
Show me and I will remember
Teach me and I will learn
 
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to