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

XML Object 1:
<?xml version="1.0" encoding="UTF-8"?>
<styles>
  <style>
    <property>background</property>
    <value>#FFFFFF</value>
  </style>
</styles

XML Object 2:
<?xml version="1.0" encoding="UTF-8"?>
<styles>
 <style>
    <property>border-color</property>
    <value>#00A0AF</value>
  </style>
</styles>

I want to take the <style> node in XML Object 2 and add/insert it into
XML Object 1 so I end up with this result:

<?xml version="1.0" encoding="UTF-8"?>
<styles>
  <style>
    <property>background</property>
    <value>#FFFFFF</value>
  </style>
 <style>
    <property>border-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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en.

Reply via email to