heh. how queer! Paul's method works well.
> -----Original Message----- > From: Niklas Richardson [mailto:[EMAIL PROTECTED] > Sent: 16 July 2003 10:58 > To: [EMAIL PROTECTED] > Subject: RE: [ cf-dev ] adding elements to xml packets > > > Hi Rich, > > How weird - I'm fighting the same problem at the moment. > > What I want to do is put in some XML like this: > > <something> > <somethingelse id="blah"/> > </something> > > Into an XML doc like this > > <root> > <node> > <something/> > <something/> > </node> > <node> > <something/> > <node> > </root> > > Infact I want to put it in the second <node> group. > > What I could do is: > > arrayappend(xmldoc.root.xmlchildren[2].xmlchildren, xmlelemnew(xmldoc, > "something")); > > And then add all the other stuff... > > But to me that seems a pain in the a*se.... > > Surely there is a way of just putting in my chunk of XML into the main > doc? > > Cheers > > Niklas > > > > > > > -----Original Message----- > > From: Rich Wild [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, July 16, 2003 10:30 AM > > To: '[EMAIL PROTECTED]' > > Subject: RE: [ cf-dev ] adding elements to xml packets > > > > > > > XmlElemNew(xmlObj, childName) > > > > > > Appears to do what you want (not tested it though!) > > > > I know, thats what I'm using in the sample code I've given below! > > > > I need to find the proper syntax of doing it though, its not as > > straightforward as it may at first appear. > > > > > -----Original Message----- > > > From: Paul Johnston [mailto:[EMAIL PROTECTED] > > > Sent: 16 July 2003 10:30 > > > To: [EMAIL PROTECTED] > > > Subject: RE: [ cf-dev ] adding elements to xml packets > > > > > > > > > XmlElemNew(xmlObj, childName) > > > > > > Appears to do what you want (not tested it though!) > > > > > > Paul > > > > > > > -----Original Message----- > > > > From: Rich Wild [mailto:[EMAIL PROTECTED] > > > > Sent: 16 July 2003 10:24 > > > > To: '[EMAIL PROTECTED]' > > > > Subject: RE: [ cf-dev ] adding elements to xml packets > > > > > > > > > > > > nah, I'd like to learn the xml way of doing it. > > > > > > > > > -----Original Message----- > > > > > From: Matt Horn [mailto:[EMAIL PROTECTED] > > > > > Sent: 16 July 2003 10:23 > > > > > To: [EMAIL PROTECTED] > > > > > Subject: Re: [ cf-dev ] adding elements to xml packets > > > > > > > > > > > > > > > Regexp? > > > > > > > > > > ----- Original Message ----- > > > > > From: "Rich Wild" <[EMAIL PROTECTED]> > > > > > To: <[EMAIL PROTECTED]> > > > > > Sent: Wednesday, July 16, 2003 11:19 AM > > > > > Subject: [ cf-dev ] adding elements to xml packets > > > > > > > > > > > > > > > > To date I've only ever used <cfxml> to create fresh whole > > > > > packets of xml > > > > > > data and xmlparse to read them, but now I need to take an > > > > > existing xml > > > > > > packet (read in via cffile) and add elements to it. > > > > > > > > > > > > this is for error logging, so the structure I have is: > > > > > > > > > > > > <incidents> > > > > > > <error> > > > > > > <date>{ts '2003-07-16 10:14:40'}</date> > > > > > > <referer>some_page.cfm</referer> <diagnostics>You > > experienced a > > > > > > general lack of CF skills on some_page.cfm</diagnostics> > > > > > > </error> > > > > > > </incidents> > > > > > > > > > > > > I want to take this packet and add a new error > element to it. > > > > > > > > > > > > so far I have this: > > > > > > > > > > > > <cfscript> > > > > > > errorelem = xmlelemnew(errorpacket, "error"); > > > > > > > > > > > > errordate = xmlelemnew(errorelem, "date"); > > errordate.xmlText = > > > > > > now(); arrayappend(errorelem.xmlchildren, errordate); > > > > > > > > > > > > errormsg = xmlelemnew(errorelem, "referer"); > > errormsg.xmltext = > > > > > > error.httpreferer; arrayappend(errorelem.xmlchildren, > > errormsg); > > > > > > > > > > > > errordetail = xmlelemnew(errorelem, "diagnostics"); > > > > > > errordetail.xmltext = error.diagnostics; > > > > > > arrayappend(errorelem.xmlchildren, errordetail); > > > > > > > > > > > > arrayappend(errorpacket.xmlroot.xmlchildren, errorelem); > > > > </cfscript> > > > > > > > > > > > > which gives me a java casting error (why do cfmx errors > > > > > seem to miss out > > > > > > line numbers these days?) > > > > > > > > > > > > can anyone help me with the correct syntax? > > > > > > > > > > > > much thankings... > > > > > > > > > > > > ------------------------------------------------------- > > > > > > Rich Wild > > > > > > Senior Simian > > > > > > ------------------------------------------------------- > > > > > > e-mango Tel: 01202 755 300 > > > > > > Gild House Fax: 01202 755 301 > > > > > > 74 Norwich Avenue West > > > > > > Bournemouth Mailto:[EMAIL PROTECTED] > > > > > > BH2 6AW, UK http://www.e-mango.com > > > > > > ------------------------------------------------------- > > > > > > This message may contain information which is legally > > > privileged > > > > > > and/or confidential. If you are not the intended > > > > recipient, you are > > > > > > hereby notified that any unauthorised disclosure, copying, > > > > > > distribution or use of this information is strictly > > > > prohibited. Such > > > > > > notification notwithstanding, any comments, opinions, > > > > > > information or conclusions expressed in this message > > > > > > are those of the originator, not of e-mango.com ltd, > > > > > > unless otherwise explicitly and independently indicated > > > > > > by an authorised representative of e-mango.com ltd. > > > > > > ------------------------------------------------------- > > > > > > > > > > > > > > > > > > -- > > > > > > ** Archive: > > > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > > > > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > > For additional commands, e-mail: > > > > [EMAIL PROTECTED] For > > > > > human help, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > -- > > > > ** Archive: > > http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] For human help, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > -- > > > ** Archive: > > http://www.mail-archive.com/dev%> 40lists.cfdeveloper.co.uk/ > > > > > > > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] For human help, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > -- > > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
