[cfaussie] Re: Coldfusion XML, adding an XML node from another XML document object

2010-04-17 Thread amay0048
Coldfusion XML objects can be manipulated by the native coldfusion
struct and array methods, depending on the xml parts you wish to
manipulate.

Full list of native functions is here:
http://www.co.multnomah.or.us/cfdocs/Developing_ColdFusion_MX_Applications_with_CFML/XML7.html

On Mar 4, 6:17 am, BarryC barrychester...@gmail.com wrote:
 Hi,

 I've hunted around for a solution to this but haven't found a simple
 or clean one (maybe there isn't one) but maybe someone here has some
 suggestions.

 I have twoXMLobjects and I want to take anXMLnode from one and
 insert it into the other

 XMLObject 1:
 ?xmlversion=1.0 encoding=UTF-8?
 styles
   style
     propertybackground/property
     value#FF/value
   /style
 /styles

 XMLObject 2:
 ?xmlversion=1.0 encoding=UTF-8?
 styles
  style
     propertyborder-color/property
     value#00A0AF/value
   /style
 /styles

 I want to take the style node inXMLObject 2 andadd/insert it intoXMLObject 
 1 so I end up with this result:

 ?xmlversion=1.0 encoding=UTF-8?
 styles
   style
     propertybackground/property
     value#FF/value
   /style
  style
     propertyborder-color/property
     value#00A0AF/value
   /style
 /styles

 You can't do a direct assignment like this:
 cfset
 arrayAppend(xmlObj1.styles.XMLChildren,xmlObj2.styles.XMLChildren[1])
 as it complains with the message:WRONG_DOCUMENT_ERR: A node is used in
 a different document than the one that created it.

 There doesn't seem to be any simple examples on how to use
 XmLElemNew() to create a copy of a node easily it looks like you'd
 have to manually iterate through the element attributes and set them.

 Thanks
 Barry

-- 
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.



[cfaussie] Re: Coldfusion XML, adding an XML node from another XML document object

2010-03-04 Thread BarryC
Thanks,
yes I had stumbled across that in my hunting. Seems odd how there are
not some proper Coldfusion commands for that sort of stuff, it's like
they decided to make half the XML functions and then gave up.

On Mar 4, 11:49 am, Kym Kovan dev-li...@mbcomms.net.au wrote:
 On 4/03/2010 07:17, BarryC wrote:

  Hi,

  I've hunted around for a solution to this but haven't found a simple
  or clean one (maybe there isn't one) but maybe someone here has some
  suggestions.

  I have two XML objects and I want to take an XML node from one and
  insert it into the other

 Ben Nadel has some nice tools:

 http://www.bennadel.com/blog/1532-Copy-Import-XML-Nodes-Into-A-ColdFu...

 we grabbed a bunch of his XML tools and other stuff we found and put
 them in a XML utility CFC, it gets used lots :-)

 --

 Yours,

 Kym Kovan
 mbcomms.net.au

-- 
You received this message because you are subscribed to the Google Groups 
cfaussie group.
To post to this group, send email to cfaus...@googlegroups.com.
To unsubscribe from this group, send email to 
cfaussie+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.