---
title: "parser(_:foundComment:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/xmlparserdelegate/parser(_:foundcomment:)"
---

# parser(_:foundComment:)

Sent by a parser object to its delegate when it encounters a comment in the XML.

## Declaration

```swift
optional func parser(_ parser: XMLParser, foundComment comment: String)
```

## Parameters

- `parser`: An NSXMLParser object parsing XML.
- `comment`: A string that is a the content of a comment in the XML.

## See Also

### Handling XML

- [parserDidStartDocument(_:)](foundation/xmlparserdelegate/parserdidstartdocument(_:).md)
- [parserDidEndDocument(_:)](foundation/xmlparserdelegate/parserdidenddocument(_:).md)
- [parser(_:didStartElement:namespaceURI:qualifiedName:attributes:)](foundation/xmlparserdelegate/parser(_:didstartelement:namespaceuri:qualifiedname:attributes:).md)
- [parser(_:didEndElement:namespaceURI:qualifiedName:)](foundation/xmlparserdelegate/parser(_:didendelement:namespaceuri:qualifiedname:).md)
- [parser(_:didStartMappingPrefix:toURI:)](foundation/xmlparserdelegate/parser(_:didstartmappingprefix:touri:).md)
- [parser(_:didEndMappingPrefix:)](foundation/xmlparserdelegate/parser(_:didendmappingprefix:).md)
- [parser(_:resolveExternalEntityName:systemID:)](foundation/xmlparserdelegate/parser(_:resolveexternalentityname:systemid:).md)
- [parser(_:parseErrorOccurred:)](foundation/xmlparserdelegate/parser(_:parseerroroccurred:).md)
- [parser(_:validationErrorOccurred:)](foundation/xmlparserdelegate/parser(_:validationerroroccurred:).md)
- [parser(_:foundCharacters:)](foundation/xmlparserdelegate/parser(_:foundcharacters:).md)
- [parser(_:foundIgnorableWhitespace:)](foundation/xmlparserdelegate/parser(_:foundignorablewhitespace:).md)
- [parser(_:foundProcessingInstructionWithTarget:data:)](foundation/xmlparserdelegate/parser(_:foundprocessinginstructionwithtarget:data:).md)
- [parser(_:foundCDATA:)](foundation/xmlparserdelegate/parser(_:foundcdata:).md)
