Skip to content

Commit

Permalink
Merge pull request #86 from brandonshin/master
Browse files Browse the repository at this point in the history
added property to allow removal of child nodes
  • Loading branch information
tid-kijyun authored Aug 4, 2016
2 parents ef00828 + 92dc19c commit cd934e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Kanna.swift
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public protocol XMLElement: SearchableNode {

func addPrevSibling(node: XMLElement)
func addNextSibling(node: XMLElement)
func removeChild(node: XMLElement)
}

/**
Expand Down
9 changes: 9 additions & 0 deletions Sources/libxmlHTMLNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ internal final class libxmlHTMLNode: XMLElement {
xmlUnlinkNode(node.nodePtr)
xmlAddChild(nodePtr, node.nodePtr)
}

func removeChild(node: XMLElement) {

guard let node = node as? libxmlHTMLNode else {
return
}
xmlUnlinkNode(node.nodePtr)
xmlFree(node.nodePtr)
}
}

private func libxmlGetNodeContent(nodePtr: xmlNodePtr) -> String? {
Expand Down

0 comments on commit cd934e6

Please sign in to comment.