---
title: "init(stream:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/xmlparser/init(stream:)"
---

# init(stream:)

Initializes a parser with the XML contents from the specified stream and parses it.

## Declaration

```swift
convenience init(stream: InputStream)
```

## Parameters

- `stream`: The input stream. The content is incrementally loaded from the specified stream and parsed. The NSXMLParser will open the stream, and synchronously read from it without scheduling it.

## Return Value

Return Value An initialized NSXMLParser object or nil if an error occurs.

## See Also

### Initializing a Parser Object

- [init(contentsOf:)](foundation/xmlparser/init(contentsof:).md)
- [init(data:)](foundation/xmlparser/init(data:).md)
