@@ -372,27 +372,33 @@ open class XMLNode: NSObject, NSCopying {
372
372
case . namespace:
373
373
return _CFXMLNamespaceCopyValue ( _xmlNode) ? . _swiftObject
374
374
375
+ case . element:
376
+ // As with Darwin, children's string values are just concanated without spaces.
377
+ return children? . compactMap ( { $0. stringValue } ) . joined ( ) ?? " "
378
+
375
379
default :
376
380
return _CFXMLNodeCopyContent ( _xmlNode) ? . _swiftObject
377
381
}
378
382
}
379
383
set {
380
- if case . namespace = kind {
384
+ switch kind {
385
+ case . namespace:
381
386
if let newValue = newValue {
382
387
precondition ( URL ( string: newValue) != nil , " namespace stringValue must be a valid href " )
383
388
}
384
-
385
389
_CFXMLNamespaceSetValue ( _xmlNode, newValue, Int64 ( newValue? . utf8. count ?? 0 ) )
386
- return
387
- }
388
390
389
- _removeAllChildNodesExceptAttributes ( ) // in case anyone is holding a reference to any of these children we're about to destroy
391
+ case . comment, . text:
392
+ _CFXMLNodeSetContent ( _xmlNode, newValue)
390
393
391
- if let string = newValue {
392
- let newContent = _CFXMLEncodeEntities ( _CFXMLNodeGetDocument ( _xmlNode) , string) ? . _swiftObject ?? " "
393
- _CFXMLNodeSetContent ( _xmlNode, newContent)
394
- } else {
395
- _CFXMLNodeSetContent ( _xmlNode, nil )
394
+ default :
395
+ _removeAllChildNodesExceptAttributes ( ) // in case anyone is holding a reference to any of these children we're about to destroy
396
+ if let string = newValue {
397
+ let newContent = _CFXMLEncodeEntities ( _CFXMLNodeGetDocument ( _xmlNode) , string) ? . _swiftObject ?? " "
398
+ _CFXMLNodeSetContent ( _xmlNode, newContent)
399
+ } else {
400
+ _CFXMLNodeSetContent ( _xmlNode, nil )
401
+ }
396
402
}
397
403
}
398
404
}
0 commit comments