chenyunguiMilook / SwiftyXML

The most swifty way to deal with XML data in swift 5.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you delete a child?

revcom opened this issue · comments

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

commented

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

Thanks

Kevin

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