chenyunguiMilook / SwiftyXML

The most swifty way to deal with XML data in swift 5.
MIT License
103 stars 28 forks source link

How do you delete a child? #14

Open revcom opened 4 years ago

revcom commented 4 years ago

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

Many thanks

Robert

chenyunguiMilook commented 4 years ago

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

Thanks

Kevin

revcom commented 4 years ago

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