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

How do you delete a child? #14

Open
revcom opened this issue Oct 12, 2020 · 2 comments
Open

How do you delete a child? #14

revcom opened this issue Oct 12, 2020 · 2 comments

Comments

@revcom
Copy link

revcom commented Oct 12, 2020

In your example xml, how would you delete a complete tag: for example everything between <catalog_item> and </catalog_item> including the starting and ending tags? I want to replace a complete item with an updated version.

Many thanks

Robert

@chenyunguiMilook
Copy link
Owner

Hi, Robert:
this project is mainly focusing on XML parsing and XML construction, editing tag is not support yet.

Thanks

Kevin

@revcom
Copy link
Author

revcom commented Oct 12, 2020

Thanks Kevin

Based on your reply, I downloaded your code and implemented my own function to allow replacement of a tag as well as adding to it.

@discardableResult public func replaceChildren(_ xmls: [XML]) -> XML { children.removeAll() return addChildren(xmls) }

Please let me know when you implement support for editing and I will happily upgrade to your latest version

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

2 participants