---
title: "normalizeAdjacentTextNodesPreservingCDATA(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlelement/normalizeadjacenttextnodespreservingcdata(_:)"
---

# normalizeAdjacentTextNodesPreservingCDATA(_:)

Coalesces adjacent text nodes of the receiver that you have explicitly added, optionally including CDATA sections.

## Declaration

```swift
func normalizeAdjacentTextNodesPreservingCDATA(_ preserve: Bool)
```

## Parameters

- `preserve`: doc://com.apple.documentation/documentation/Swift/true if CDATA sections are left alone as text nodes, doc://com.apple.documentation/documentation/Swift/false otherwise.

## Discussion

Discussion A text node with a value of an empty string is removed. When you process an input source of XML, adjacent text nodes are automatically normalized. You should invoke this method (with preserve as false) before using the XMLNode methods objects(forXQuery:constants:) or nodes(forXPath:).

## See Also

### Manipulating Child Elements

- [addChild(_:)](foundation/xmlelement/addchild(_:).md)
- [insertChild(_:at:)](foundation/xmlelement/insertchild(_:at:).md)
- [insertChildren(_:at:)](foundation/xmlelement/insertchildren(_:at:).md)
- [removeChild(at:)](foundation/xmlelement/removechild(at:).md)
- [replaceChild(at:with:)](foundation/xmlelement/replacechild(at:with:).md)
- [setChildren(_:)](foundation/xmlelement/setchildren(_:).md)
