Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to make copy of element? #119

Closed
PharmCat opened this issue Jan 21, 2022 · 0 comments
Closed

is it possible to make copy of element? #119

PharmCat opened this issue Jan 21, 2022 · 0 comments

Comments

@PharmCat
Copy link

I try to copy some elements from one xml to another:

#source
xdoc = parse_file("test.xml")
odm = LightXML.root(xdoc)
st = LightXML.find_element(odm, "Study")

#destination
xd = XMLDocument()
e = create_root(xd, "Study")
elm = collect(LightXML.child_elements(st));

# this remove from source to destination
dc = deepcopy(elm[4])
unlink(dc)
add_child(e, dc)

#this copy all elements to xd ???  why ?
add_child(e, elm[4])

#this copy all elements to xd  too
add_child(e, deepcopy(elm[4]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant