Copying XmlElement data/attributes to another element


#1

Hey
I have two XmlElement objects, and I would like to replace all the data/attributes of one of the elements with the data/attributes of the other element. What would be the best way to do this?

XmlElement::replaceChildElement() seemed liked the obvious choice to me, however I don’t want the elements tag name to change. Would it be possible to add a function such as replaceChildElementAttributes()?

Thanks.


#2

Does operator= not do the job?


#3

I hadn’t even considered operator=. I think thats what I needed. Thanks.


#4

I was looking for some kind of ‘merge’ or operator+ the other day. Nothing for that?

I need to combine XmlElements, optionally keeping unique child tags, so individual child elements would merge also (recursively, I suppose).

I didn’t see anything?

Bruce


#5

I don’t remember all the methods in the XML class, but that does sound like something you’d need to write a custom function for.